Author terry.reedy
Recipients BreamoreBoy, Todd.Rovito, philwebster, terry.reedy
Date 2014-08-03.21:16:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407100593.68.0.852479737619.issue18766@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-08-03 21:16:33terry.reedysetrecipients: + terry.reedy, BreamoreBoy, Todd.Rovito, philwebster
2014-08-03 21:16:33terry.reedysetmessageid: <1407100593.68.0.852479737619.issue18766@psf.upfronthosting.co.za>
2014-08-03 21:16:33terry.reedylinkissue18766 messages
2014-08-03 21:16:33terry.reedycreate