[Python-Dev] BDFL-Delegate appointments for several PEPs
tjreedy at udel.edu
Sun Mar 24 22:01:14 EDT 2019
On 3/24/2019 7:00 PM, Cameron Simpson wrote:
> On 24Mar2019 17:02, Terry Reedy <tjreedy at udel.edu> wrote:
>> On 3/24/2019 8:21 AM, Nick Coghlan wrote:
>>> * PEP 499: Binding "-m" executed modules under their module name as
>>> well as `__main__`
>> My brief response: +1 unless there is a good reason not.
> There turn out to be some subtle side effects. The test suite turned up
> one (easily fixed) in pdb, but there are definitely some more things to
> investigate. Nick has pointed out pickle and the "python -i" option.
> I'm digging into these. (Naturally, I have _never_ before used the pdb
> or pickle modules, or the -i option :-)
>> There have been multiple double module problems reported on
>> python-list and likely stackoverflow. And would there be any impact
>> on circular imports?
> Well, by binding the -m module to both __main__ and its name as denoted
> on the command line one circular import is directly short circuited.
> Aside from the -m module itself, I don't think there should be any other
> direct effect on circular imports.
> 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__']
(It turns out that this fails for other reasons, which I am looking
into. The current recommendation is to start IDLE by runing any of
__main__.py (via python -m idlelib), idle.py, idlew.py, or idle.bat.)
Terry Jan Reedy
More information about the Python-Dev