New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE "AttributeError: 'NoneType' object has no attribute 'index'" from Delegator.py #61813
Comments
Running ILDE with 2.7.4 RC 1 on Mac OS X 10.8 and with ActiveTCL 8.5.13 using "python -m idlelib.idle", I object the following traceback messages. I'm unsure what events are triggering it: Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1470, in __call__
return self.func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 531, in callit
func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/ColorDelegator.py", line 153, in recolorize
self.recolorize_main()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/ColorDelegator.py", line 186, in recolorize_main
next = self.index(mark + "+%d lines linestart" %
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/Delegator.py", line 10, in __getattr__
attr = getattr(self.delegate, name) # May raise AttributeError
AttributeError: 'NoneType' object has no attribute 'index' |
Raymond, |
Setting as 2.7.4 release blocker pending further analysis. Roger, any ideas? Would having the contents of Raymond's .idlerc files be of help? Raymond, does IDLE terminate when the exception occurs or does it keep running? |
Do you get the same traceback with "python -m idlelib"? |
"python -m idlelib" isn't implemented for 2.7.x, is it? |
It's a "race condition" due to ColorDelegator calling .update() in its recolorize method. The call to .update() flushes pending events, including callbacks into Python code that can change out the ColorDelegator in the Percolator chain. Here's a way to trigger this bug reliably. First we need an unreasonably large file that will make the syntax highlighting routine take a while. This code will generate such a file: fid = open('/tmp/bigfile.py', 'w')
L = '\n'.join(map(lambda x: "#%i\n'%i'\n" % (x,x), range(10000)))
fid.writelines(L)
fid.close() These next two steps need to be performed quickly to trigger the "race condition." $ python -m idlelib.idle -e /tmp/bigfile.py
As soon as it loads, press Ctrl+Shift+S to bring up the Save-As dialog. You can take your time now. Overwrite the file. This triggers the filename_change_hook to call ResetColorizer, which removes the current ColorDelegator from the Percolator chain and inserts a new one. Wait a moment for the traceback to arrive. The attached patch fixes the issue. When the ColorDelegator is removed by Percolator's removefilter, the delegate is set to None. The patch detects that condition and then sets flags to stop the colorizer from continuing. In testing for this bug, I encountered another one. Pressing Alt-F4 quickly after the window loading bigfile appears triggers another traceback. I'll open a separate issue for that. |
Yes, idlelib.__main__.py was only added to 3.3. |
Removing Geoge and Larry from nosy. I'm not sure how they got added. I didn't click on anything in the Nost List box. Ned, did you mean to add Benjamin to the nosy list? |
Is there an automatic nosy-list adder routine in the bug-tracker that I should know about? Georg and Larry were re-added to nosy even after I removed them. (I'm sorry for the spam.) |
It keeps running. |
When an issue is marked as "release blocker", the release managers of all affected versions are automatically added to the issue. I'm the release manager of 3.4, Georg is for 3.3. |
Release managers are added automatically when an issue is set as release blocker and one of the releases they manage is selected in the "Versions" field. |
I dont have ActiveState TCL, but I could use IDLE with the default libs with my Macbook Pro (OS X10.7), followed the steps given to reproduce the error and unfortunately could not. |
I'm able to reliably reproduce the exception using your test procedure, Roger, using either current head of 3.3 or 2.7, and am not able to reproduce it with stop_colorizer.patch applied. LGTM. So it seems to me the next questions are:
|
On 04/02/2013 12:57 AM, Ned Deily wrote:
|
Thank you for the analysis. |
New changeset ae05d841bea1 by Roger Serwy in branch '2.7': New changeset 8b793a946acb by Roger Serwy in branch '3.3': New changeset b45675223885 by Roger Serwy in branch 'default': |
Thank you everyone for your patience. I am closing this issue as fixed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: