GNU bug report logs -
#15975
24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line.
Previous Next
Reported by: James De Ricco <jcdericco <at> optonline.net>
Date: Mon, 25 Nov 2013 21:00:04 UTC
Severity: normal
Tags: patch
Merged with 23898
Found in versions 24.3, 24.3.50
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line.
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 15975 <at> debbugs.gnu.org.
--
15975: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15975
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Version: 24.4
Thanks; fixed.
[Message part 3 (message/rfc822, inline)]
An Arithmetic error is raised when the `python-indent-line` function is
called on a buffer consisting of one non-empty line.
cd src/emacs-bzr/install-prefix/bin/
./emacs -Q
C-x b pybuf <RET> def main(): M-x python-mode <RET> C-j
*Messages* buffer:
For information about GNU Emacs and the GNU system, type C-h C-a.
python-indent-line: Arithmetic error
*Backtrace* buffer:
Debugger entered--Lisp error: (arith-error)
python-indent-calculate-levels()
python-indent-line()
python-indent-line-function()
indent-according-to-mode()
newline-and-indent()
call-interactively(newline-and-indent nil nil)
command-execute(newline-and-indent)
The patch below resolves the problem by ensuring that the function
`python-indent-guess-indent-offset` does not set `python-indent-offset`
to zero, thereby violating the precondition of the function
`python-indent-calculate-levels` which expects `python-indent-offset` to
not equal zero (otherwise attempts to modulus a number and zero). It
makes sense that `python-indent-offset` would never equal zero since the
python language requires non-zero level indentation of blocks.
*** python.el.original 2013-11-25 14:48:53.118763386 -0500
--- python.el 2013-11-25 14:49:32.601625243 -0500
***************
*** 676,682 ****
(goto-char block-end)
(python-util-forward-comment)
(current-indentation))))
! (if indentation
(set (make-local-variable 'python-indent-offset)
indentation)
(message "Can't guess python-indent-offset, using
defaults: %s"
python-indent-offset)))))))
--- 676,682 ----
(goto-char block-end)
(python-util-forward-comment)
(current-indentation))))
! (if (> indentation 0)
(set (make-local-variable 'python-indent-offset)
indentation)
(message "Can't guess python-indent-offset, using
defaults: %s"
python-indent-offset)))))))
In GNU Emacs 24.3.50.3 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll
bars)
of 2013-11-25 on jcdericco-MacBookPro-GNU
Bzr revision: 115235 bozhidar <at> batsov.com-20131125190450-w5yaffnkd8ti4o5z
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description: Trisquel 6.0
Configured using:
`configure --prefix=/home/jcdericco/src/emacs-bzr/install-prefix/'
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process inotify
dynamic-setting x-toolkit x multi-tty emacs)
This bug report was last modified 8 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.