[Python-Dev] BDFL-Delegate appointments for several PEPs

Terry Reedy tjreedy at udel.edu
Sun Mar 24 23:22:39 EDT 2019


On 3/24/2019 10:01 PM, Terry Reedy wrote:
> On 3/24/2019 7:00 PM, Cameron Simpson wrote:

>> Did you have a specific scenario in mind?
> 
> I was thinking about IDLE and its tangled web of circular inports, but I 
> am now convinced that this change will not affect it.  Indeed, 
> idlelib/pyshell.py already implements idea of the proposal, ending with
> 
> if __name__ == "__main__":
>      sys.modules['pyshell'] = sys.modules['__main__']
>      main()

After more investigation, I realized that to stop having duplicate modulue:
1. The alias should be 'idlelib.pyshell', not 'pyshell', at least when 
imports are all absolute.
2. It should be done at the top of the file, before the import of 
modules that import pyshell.

If I run python f:/dev/3x/lib/idlelib/pyshell.py, the PEP patch would 
have to notice that pyshell is a module within idlelib and alias 
'__main__' to 'idlelib.pyshell', not 'pyshell'.  Would the same be true 
if within-package import were all relative?

> (It turns out that this fails for other reasons, which I am looking 
> into.

Since starting IDLE with pyshell once worked in the past, it appears to 
be because the startup command for run.py was outdated.  Will fix.

-- 
Terry Jan Reedy




More information about the Python-Dev mailing list