infinite loop on py-indent-line

Bug #1156426 reported by Jarvis Schultz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
High
Andreas Roehler

Bug Description

Hitting C-c C-v prints the following:
      Using `python-mode' version 6.0.10
M-x emacs-version returns:
      GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-11-05 on litembilla, modified by Debian

I have a bug that pops up where I am no longer able to use python-mode to tab lines. I can't determine exactly what cases cause this problem, but it seems related to the commenting rules. Perhaps because I use a combination of comment-dwim and py-comment-region to handle my commenting.

I'm attaching a file that causes the error. The file has 4 lines, a while statement, a blank line, and two commented lines. If either or both of the commented lines are uncommented, the error disappears. In the file's uploaded state, navigating to the blank line and pressing TAB prints the following message:

     py-beginning-of-comment: Variable binding depth exceeds max-specpdl-size

Running in the emacs-lisp debugger prints the following:
    Debugger entered--Lisp error: (error "Variable binding depth exceeds max-specpdl-size")
      syntax-ppss()
      py-beginning-of-comment()
      py-end-of-statement(100 t)
      py-end-of-statement(100 t)
           (.)
    (.)
    (.)
      py-end-of-statement(100 t)
      py-end-of-statement(100 t)
      py-end-of-statement(67 t)
      py-end-of-statement(21 t)
      py-end-of-statement(20 t)
      py-end-of-statement()
      py-beginning-of-statement-p()
      py-compute-indentation()
      py-indent-line(nil)
      call-interactively(py-indent-line nil nil)

Revision history for this message
Jarvis Schultz (jarvisschultz) wrote :
Changed in python-mode:
milestone: none → 6.1.2
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → High
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1156426] [NEW] infinite loop on py-indent-line

Am 18.03.2013 03:43, schrieb Jarvis Schultz:
> Public bug reported:
>
> Hitting C-c C-v prints the following:
> Using `python-mode' version 6.0.10
> M-x emacs-version returns:
> GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-11-05 on litembilla, modified by Debian
>
> I have a bug that pops up where I am no longer able to use python-mode
> to tab lines. I can't determine exactly what cases cause this problem,
> but it seems related to the commenting rules. Perhaps because I use a
> combination of comment-dwim and py-comment-region to handle my
> commenting.

Both works here right out of the box.
If you wrote something for it, please show the code.

>
> I'm attaching a file that causes the error. The file has 4 lines, a
> while statement, a blank line, and two commented lines. If either or
> both of the commented lines are uncommented, the error disappears. In
> the file's uploaded state, navigating to the blank line and pressing TAB
> prints the following message:
>
> py-beginning-of-comment: Variable binding depth exceeds max-
> specpdl-size
>
> Running in the emacs-lisp debugger prints the following:
> Debugger entered--Lisp error: (error "Variable binding depth exceeds max-specpdl-size")
> syntax-ppss()
> py-beginning-of-comment()
> py-end-of-statement(100 t)
> py-end-of-statement(100 t)
> (.)
> (.)
> (.)
> py-end-of-statement(100 t)
> py-end-of-statement(100 t)
> py-end-of-statement(67 t)
> py-end-of-statement(21 t)
> py-end-of-statement(20 t)
> py-end-of-statement()
> py-beginning-of-statement-p()
> py-compute-indentation()
> py-indent-line(nil)
> call-interactively(py-indent-line nil nil)
>

Can't reproduce. Do the error messages occur with example file?

What I see is some issue with var py-indent-comment.
If `t', you should correct the indent of comments first.

If nil, it seems to have a bug, as TAB doesn't indent.

Andreas

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 18.03.2013 03:43, schrieb Jarvis Schultz:

Checked in some changes. Maybe try again from current trunk.

Andreas

Revision history for this message
Jarvis Schultz (jarvisschultz) wrote :

The changes fixed the problem! Great work!

Just for posterity, before the changes, the problem occurred by doing the following:

1) run "emacs -q" to avoid loading my .emacs
2) In *scratch* buffer run "eval-region" on following elisp lines:
    (push "~/.emacs.d/elpa/python-mode-6.0.10/" load-path)
    (require 'python-mode)
3) run "find-file" and open original attached file
4) press C-n to move down a line
5) press TAB key
6) minibuffer prints "Variable binding depth exceeds max-specpdl-size" and no tabbing is performed

Changing above push line to read '(push "~/.emacs.d/elpa/python-mode-trunk/" load-path)' (after checking out changes), and the error disappeared.

Changed in python-mode:
status: New → Fix Committed
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1156426] Re: infinite loop on py-indent-line

Am 19.03.2013 08:44, schrieb Jarvis Schultz:
> The changes fixed the problem! Great work!
>
> Just for posterity, before the changes, the problem occurred by doing
> the following:
>
> 1) run "emacs -q" to avoid loading my .emacs
> 2) In *scratch* buffer run "eval-region" on following elisp lines:
> (push "~/.emacs.d/elpa/python-mode-6.0.10/" load-path)

As elpa is now inside GNU Emacs, seems python-mode is no longer distributed there

It's known to be part of several other repos.
Looks like el-get provides it on a regular basis:

http://yergler.net/blog/2011/04/19/managing-my-emacs-packages-with-el-get/

Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.