eat 100% CPU when "Force full reparse"

Bug #328805 reported by Pupilzeng on 2005-06-05
Affects Status Importance Assigned to Milestone

Bug Description

it seems to come into a infinite loop, and I can't do
anything but Ctrl+C to end emacs and all my datas were
It ocurred every time I type M-/ for code completion.
my emacs is, checkout from the branch
unicode-2 on April, 2, 2005


Montanaro (montanaro) wrote :

What version of python-mode.el are you using?

Montanaro (montanaro) wrote :

Can you provide an example Python file where this happens? Given that
M-/ runs dabbrev-expand, I'm skeptical this has anything to do with

Pupilzeng (pupilzeng) wrote :

OK, here's an example:
class A:
        def __init__(self, name):
        = name

if __name__ == '__main__':
        a = A('abc')
        a.<------------- M-/ here, the bug can be reproduced

the python-mode is 1.0alpha

Pupilzeng (pupilzeng) wrote :

When I'm editing C source files in cc-mode, the problem
doesn't occur

Montanaro (montanaro) wrote :

Hmmm... It's been years and years since Python-mode 1.0alpha was
released, so I suspect you're looking in the wrong place for the version.

We are currently at 4.75. You can get the current python-mode version
by typing

    M-: py-version RET

When I hit M-/ at the place you indicated, it completes with "c12".
I have no idea why it chooses that completion, but it doesn't hang.
It's not obvious to me what it should expand in this context. Did
you have something in mind? If I change the code to

    a = A('abc') = 12

when I hit M-/ it properly expands to "" for me.

Please try upgrading your python-mode.

Pupilzeng (pupilzeng) wrote :

M-: py-version RET
"$Revision 4.63 $"
I downloaded it from, whose version
was tagged as 1.0alpha
Where can I get the version 4.75?

I've tried write codes as you said: = 12
a. M-/ repeatly
First: "py"
Seconed: Force full parse and the problem occurred.

Todddeluca (todddeluca) wrote :

I am having the same problem.

It started happening around the time my box was upgraded to
the new Debian stable release, Sarge.

I am using version 4.75 of python-mode.

The problem manifests seemingly randomly for me. It seems
to happen more with short python files. I can not think of
a long or old (pre-upgrade to sarge) python file where I've
had this problem.

I am not using M-/ (code completion). The problem may
manifest when I hit return to go to a new line or when I hit
backspace to unindent out of a block that I've just ended.

I am using gnu emacs version 21.4.1

I am forced to kill <pid> from a different terminal to close
my emacs, since I run it in the foreground of a terminal.

Any suggestions for how to fix this problem would be greatly
appreciated. It makes it nearly impossible to use
python-mode when at any time emacs can freeze and loose all
of my work (since my last save.) I'm sorry I have not been
able to reproduce the problem consistently yet. If that is
helpful I will attempt to do so.

Best regards,
Todd DeLuca

P.S. some diagnostic info (a repeat of what was mentioned
$ emacs --version
GNU Emacs 21.4.1

from top command:
3440 td23 14 0 19336 18m 2900 R 99.9 0.5 16:05.32

python-mode version (from C-c C-v): version $Revision: 4.75 $

Todddeluca (todddeluca) wrote :

Ok, I've created a simple reproducible example. The
following code consistently freezes if the last character in
the file is '1'. If there is a newline following the '1',
then everything is fine.
if 1 < 2:
    # die here

    x = 1

It also freezes under the same condition if you replace the
if statement with a for i in range(10): loop.

The following file does NOT freeze even if the '1' is the
last character in the file:
x = 1

So perhaps it has something to do with the indentation.
Everything seems to hinge on there being no characters
following the last line of code. I tried putting spaces on
the end of the 'x = 1' line and it still froze with a 'Force
full reparse' message. Sometimes the 'Force full reparse'
message is not displayed when it freezes, but I think that
detail is insignificant.

I hope these code snippets are helpful in debugging the
problem. Thank y'all for producing and maintaining
python-mode. Its coloring and indenting features have been
very helpful to me, and I get the feeling I'm just
scratching the surface.


This occurs for me when there is a block (function, for, if,
etc) that doesn't have a blank new line after it. As soon as
the file is loaded, the CPU pegs and emacs freezes.

Thimo-users (thimo-users) wrote :

As this bug bit me many times in the last days I've checked
with a friend if he experiences the same: in his emacs (also
Debian stable) there are no freezes. As he has no "semantic"
installed but I do I'd guess that it is the culprit.

BTW: the fixes in the patch mentioned on

did not cure this bug.

For reference: I'm using Emacs 21.4.1, python-mode 4.75,
semantic 1.0beta3b

Todddeluca (todddeluca) wrote :

Based on the previous comment by thimo, I investigated the
"semantic" issue a little further. On my system the
"semantic" stuff comes from the CEDET
( and site-lisp
packages being loaded. One way to avoid loading these tools
is to run emacs with the --no-site-file option. This fixes
the freezing that was occurring in the code example I
provided below. These site packages are common to all
users, so I can not simply remove them from the system. If
anyone has a more fine-grained way to do this, one that does
not remove all site-lisp packages, feel free to share.

Todd DeLuca

Shreddd (shreddd) wrote :

Looks like there is a workaround for this problem:;diff=2;id=CollectionOfEmacsDevelopmentEnvironmentTools

Basically, CEDET is broken wrt python autocompletion. In the
file cedet-dir/semantic/wisent/wisent-python.el, comment out
the line:

    (add-hook 'python-mode-hook #'wisent-python-default-setup)

Everything worked great after that

Andreas Roehler (a-roehler) wrote :

Hi Skip,

understanding the issue was tracked onto CEDET, it's not a bug .

Examples worked fine here.

Suggest to close it.



Changed in python-mode:
status: Confirmed → Incomplete
assignee: Montanaro (montanaro) → Andreas Roehler (a-roehler)
Changed in python-mode:
assignee: Andreas Roehler (a-roehler) → nobody
Changed in python-mode:
importance: Medium → Undecided
Launchpad Janitor (janitor) wrote :

[Expired for python-mode.el because there has been no activity for 60 days.]

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

Other bug subscribers