python-mode loops on if/else
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mode.el |
Fix Released
|
Medium
|
Andreas Roehler |
Bug Description
(migrating from python project)
Original submission:
Here's how to reproduce. Create a .py file in XEmacs
containing this text:
x = (if 1: 2
____else: 3)
(except that the ____ really means four spaces).
Now position your cursor somewhere inside those 4
spaces, and hit TAB. XEmacs freezes until you hit
^G.
Followup comments:
Date: 2003-07-31 22:41
Sender: montanaro
Logged In: YES
user_id=44345
The code gets into an infloop in py-outdent-p. The
loop looks
odd to me:
(while (or (looking-at py-blank-
(backward-
If you were at (bobp), why would you want to try to
move back
a line?
[http://
Related branches
- python-mode.el developers: Pending requested
-
Diff: 5004 lines (+2516/-1849)5 files modifiedUnicodeEncodeError-lp:550661-test.py (+4/-0)
py-bug-numbered-tests.el (+738/-245)
python-mode-test.el (+202/-0)
python-mode-tests.sh (+88/-0)
python-mode.el (+1484/-1604)
Changed in python-mode: | |
assignee: | nobody → Andreas Roehler (a-roehler) |
Changed in python-mode: | |
status: | New → Fix Committed |
Changed in python-mode: | |
milestone: | none → 6.0 |
Changed in python-mode: | |
status: | Fix Committed → Fix Released |
I can confirm this bug.
The following two line file also causes an infinite loop:
a
else:
When the colon is typed, the inifinite loop is triggered.
I think the following change fixes the problem:
- (while (or (looking-at py-blank- or-comment- re) or-comment- re)
(backward- to-indentation 1))
- (bobp))
+ (while (and (looking-at py-blank-
+ (not (bobp)))