homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add a "target" parameter to runpy.run_path and runpy.run_module
Type: enhancement Stage: needs patch
Components: Versions: Python 3.8
process
Status: open Resolution:
Dependencies: 19700 Superseder:
Assigned To: Nosy List: CuriousLearner, brett.cannon, eric.snow, nanjekyejoannah, ncoghlan, piotr.dobrogost
Priority: normal Keywords:

Created on 2013年12月14日 13:22 by ncoghlan, last changed 2022年04月11日 14:57 by admin.

Messages (5)
msg206181 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2013年12月14日 13:22
One idea from PEP 451 was to add a "target" parameter to runpy.run_path and runpy.run_module to allow them to support execution in an existing module namespace (like __main__).
This missed the feature freeze deadline for 3.4, but can be added in 3.5.
msg206430 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2013年12月17日 12:48
Implementing this is actually likely to require non-trivial restructuring of the runpy internals. contextlib.ExitStack may prove useful in making it easier to programmatically select amongst different context managers.
The __mp_main__ helpers in multiprocessing should also be able to take advantage of this once it is available, and it may prove useful in finally providing -m analogues for pdb etc that play nice when an exception occurs (see issue 9325).
msg305671 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2017年11月06日 19:45
Hey ncoghlan,
Does this issue makes sense to be worked on for Python 3.7?
msg305719 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2017年11月07日 07:57
See issue 21862 and issue 9325 as potential use cases for this feature.
While it looks like issue 21862 (-m switch support in cProfile) can be implemented just fine without it, this feature will be needed for the modules that execute the given scripts directly in __main__.__dict__ (e.g. pdb).
msg349121 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019年08月06日 17:38
issue 19978 also needs this.
History
Date User Action Args
2022年04月11日 14:57:55adminsetgithub: 64181
2019年08月06日 17:38:32nanjekyejoannahsetmessages: + msg349121
2019年06月20日 18:19:47nanjekyejoannahsetnosy: + nanjekyejoannah
2018年06月04日 12:58:12ncoghlansetversions: + Python 3.8, - Python 3.7
2017年11月07日 07:57:46ncoghlansetversions: + Python 3.7, - Python 3.5
2017年11月07日 07:57:38ncoghlansetmessages: + msg305719
2017年11月06日 19:45:00CuriousLearnersetnosy: + CuriousLearner
messages: + msg305671
2016年02月22日 09:26:51piotr.dobrogostsetnosy: + piotr.dobrogost
2013年12月17日 12:48:44ncoghlansetmessages: + msg206430
2013年12月14日 13:22:30ncoghlanlinkissue19978 dependencies
2013年12月14日 13:22:13ncoghlansetdependencies: + Update runpy for PEP 451
2013年12月14日 13:22:03ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /