Message356499
[Belatedly updating this issue with the current status as of March]
Cameron's implementation generally looks good, but there are couple of compatibility/migration questions that we need to consider, as spelled out in the PEP update that added me as BDFL-Delegate: https://github.com/python/peps/pull/946/files
* We need a generic porting guide entry to handle projects that turn out to have been relying on their name *not* being bound in sys.modules. For example, adding this preamble:
if __name__ == "__main__":
# To prevent inadvertent double imports, the -m
# switch in Python 3.9+ defaults to aliasing __main__
# under the executed module's import name. We actually
# want the double import, so remove the alias if it exists
import sys
_main_module = sys.modules.get(__name__)
_spec_module = sys.modules.get(__spec__.name)
if _main_module is _spec_module:
sys.modules.pop(__spec__.name)
We'd test the above snippet by adding it to the `pdb` module (and reverting the other compatibility changes to that module)
* We need to understand the implications for pickle compatibility, and provide a porting guide snippet, similar to the one above for explicitly requesting the double-import behaviour. For example:
if __name__ == "__main__":
# To prevent inadvertent double imports, the -m
# switch in Python 3.9+ defaults to aliasing __main__
# under the executed module's import name. We need
# pickle to use the real module name for objects from
# __main__ though, so we set the import name here
_running_as_main = True
__name__ = __spec__.name |
|
Date |
User |
Action |
Args |
2019-11-12 22:37:59 | ncoghlan | set | recipients:
+ ncoghlan, cameron, Greg Price |
2019-11-12 22:37:59 | ncoghlan | set | messageid: <1573598279.76.0.921110098351.issue36375@roundup.psfhosted.org> |
2019-11-12 22:37:59 | ncoghlan | link | issue36375 messages |
2019-11-12 22:37:59 | ncoghlan | create | |
|