bpo-36375: PEP 499 implementation: "python -m foo" binds the main module as both __main__ and foo in sys.modules by cameron-simpson · Pull Request #12490 · python/cpython

ncoghlan

ncoghlan

@cameron-simpson

@cameron-simpson

@cameron-simpson

@cameron-simpson

@cameron-simpson

@cameron-simpson

@blurb-it @cameron-simpson

@cameron-simpson

…tinct new __main__ module

With PEP499 __main__ is aliased as the canonical name of the -m module.
When pdb is invoked via "python -m pdb" it can no longer rewrite the
symbol table of the existing __main__ module because that is pdb itself.
Instead we construct a new module and insert it as sys.modules['__main__'].
…03-20-00-38-35.bpo-36375.d178R0.rst