From unknown Fri Jun 20 18:16:15 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#15975 <15975@debbugs.gnu.org> To: bug#15975 <15975@debbugs.gnu.org> Subject: Status: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line. Reply-To: bug#15975 <15975@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:16:15 +0000 retitle 15975 24.3.50; Arithmetic error upon calling `python-indent-line` i= n a buffer of a single non-empty line. reassign 15975 emacs submitter 15975 James De Ricco severity 15975 normal tag 15975 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 25 15:59:59 2013 Received: (at submit) by debbugs.gnu.org; 25 Nov 2013 20:59:59 +0000 Received: from localhost ([127.0.0.1]:44969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl3GA-00011Q-AF for submit@debbugs.gnu.org; Mon, 25 Nov 2013 15:59:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54850) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl36v-0000nS-Nt for submit@debbugs.gnu.org; Mon, 25 Nov 2013 15:50:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl36j-0004DS-CG for submit@debbugs.gnu.org; Mon, 25 Nov 2013 15:50:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_MANY_HDRS_LCASE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl36j-0004DO-90 for submit@debbugs.gnu.org; Mon, 25 Nov 2013 15:50:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl36c-00048t-Qh for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2013 15:50:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl36W-0003rh-JX for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2013 15:50:06 -0500 Received: from mta3.srv.hcvlny.cv.net ([167.206.4.198]:49725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl36W-0003ra-FN for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2013 15:50:00 -0500 Received: from [129.21.130.19] (res55557472689.rh.rit.edu [129.21.130.19]) by mta3.srv.hcvlny.cv.net (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPA id <0MWU00JH777ADKA0@mta3.srv.hcvlny.cv.net> for bug-gnu-emacs@gnu.org; Mon, 25 Nov 2013 15:49:59 -0500 (EST) Date: Mon, 25 Nov 2013 15:49:58 -0500 From: James De Ricco Subject: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line. To: bug-gnu-emacs@gnu.org Message-id: <5293B7F6.4000604@optonline.net> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Enigmail-Version: 1.5.2 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 25 Nov 2013 15:59:56 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) 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 def main(): M-x python-mode 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@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) From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 25 22:16:27 2013 Received: (at 15975-done) by debbugs.gnu.org; 26 Nov 2013 03:16:27 +0000 Received: from localhost ([127.0.0.1]:45244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl98U-0004YD-7a for submit@debbugs.gnu.org; Mon, 25 Nov 2013 22:16:26 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:55919 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl98Q-0004Y4-Dg for 15975-done@debbugs.gnu.org; Mon, 25 Nov 2013 22:16:23 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Vl98P-0001jM-Fq; Mon, 25 Nov 2013 22:16:21 -0500 From: Glenn Morris To: 15975-done@debbugs.gnu.org Subject: Re: bug#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line. References: <5293B7F6.4000604@optonline.net> X-Spook: S Key George W. Bush Exon Shell SAFE DRM Maple halcon X-Ran: 5QB\1WR1I_v7[h{2}(F?K?)C`k(k8?gE4'00>X~w~9ejX2Z(#HUm(:CgtJ&Y?!Bg7Vg_jv X-Hue: yellow X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 25 Nov 2013 22:16:21 -0500 In-Reply-To: <5293B7F6.4000604@optonline.net> (James De Ricco's message of "Mon, 25 Nov 2013 15:49:58 -0500") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 15975-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Version: 24.4 Thanks; fixed. From unknown Fri Jun 20 18:16:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 24 Dec 2013 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 17:12:32 2016 Received: (at control) by debbugs.gnu.org; 7 Dec 2016 22:12:33 +0000 Received: from localhost ([127.0.0.1]:60415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEkS0-0003TI-R2 for submit@debbugs.gnu.org; Wed, 07 Dec 2016 17:12:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEkRz-0003T7-Kg for control@debbugs.gnu.org; Wed, 07 Dec 2016 17:12:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEkRt-0006ts-Sn for control@debbugs.gnu.org; Wed, 07 Dec 2016 17:12:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEkRt-0006to-Pf for control@debbugs.gnu.org; Wed, 07 Dec 2016 17:12:25 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1cEkRt-0001pS-Fc for control@debbugs.gnu.org; Wed, 07 Dec 2016 17:12:25 -0500 Subject: control message for bug 23898 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Wed, 07 Dec 2016 17:12:25 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.0 (--------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.0 (--------) unarchive 15975 forcemerge 15975 23898 From unknown Fri Jun 20 18:16:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 05 Jan 2017 12:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator