Terry J. Reedy added the comment:

A least a manual (human) test is needed: a description of steps that do not 
work now and do work with a patch.

Currently, get_entity() is only called in one place in fetch_completions; it is 
not used anywhere else in idlelib. (Call_tips defines another get_entity().)  
Its body should be moved inline at the call site. A variation that differs in 
the second line
            namespace = __main__.__dict__.copy()
            namespace.update(__main__.__builtins__.__dict__)
is already in-lined in the if-branch above.

We are trying to eliminate bare excepts: in idlelib -- #15313 -- not expand 
them or their use. Try blocks should only include the statement or statements 
that could raise the exception or exceptions caught. So the import, once 
inlined, should be inside try: except ImportError: return... .

I do not know what the existing try: except: is meant to catch, but it includes 
too much, as does the one that follows. That, however, should be a separate 
patch.

+            namespace = sys.modules.copy()
+            namespace.update(__main__.__dict__)
seems unnecessary. I think the following should work.
           namespace[name] = sys.modules[name]
A testcase would make sure either way.

----------
stage:  -> test needed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18766>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to