[issue18055] Stop using imp in IDLE
Roger Serwy
report at bugs.python.org
Sun May 26 02:06:41 CEST 2013
Roger Serwy added the comment:
@Brett, I agree that IDLE should not be using deprecated modules. I don't know all the ins and outs of the import machinery of Python, so I'll defer to your expertise in that area. :-)
@Terry, I have never used this IDLE feature before, so I don't know all it's corner cases or expected behavior.
The patch works when opening "os" but fails with "sys". Without the patch, a dialog box appears saying "No source for module sys". With the patch, I get "not a source-based module" and then another dialog "loader does not support get_filename", and then this exception raises:
Exception in Tkinter callback
Traceback (most recent call last):
File "/home/python/python/3.4/Lib/tkinter/__init__.py", line 1475, in __call__
return self.func(*args)
File "/home/python/python/3.4/Lib/idlelib/EditorWindow.py", line 680, in open_module
self.flist.open(file_path)
UnboundLocalError: local variable 'file_path' referenced before assignment
Serhiy's review comments on the patch about adding "return" in those three places does fix that problem.
Attached is a revision to include Serhiy's suggestions.
----------
Added file: http://bugs.python.org/file30376/imp_remove_rev1.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18055>
_______________________________________
More information about the Python-bugs-list
mailing list