Issue 19982: Add a "target" parameter to runpy.run_path and runpy.run_module (original) (raw)
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/64181
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) * ![]() |
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) * ![]() |
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) * ![]() |
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) * ![]() |
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) * ![]() |
Date: 2019-08-06 17:38 |
issue 19978 also needs this. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:55 | admin | set | github: 64181 |
2019-08-06 17:38:32 | nanjekyejoannah | set | messages: + |
2019-06-20 18:19:47 | nanjekyejoannah | set | nosy: + nanjekyejoannah |
2018-06-04 12:58:12 | ncoghlan | set | versions: + Python 3.8, - Python 3.7 |
2017-11-07 07:57:46 | ncoghlan | set | versions: + Python 3.7, - Python 3.5 |
2017-11-07 07:57:38 | ncoghlan | set | messages: + |
2017-11-06 19:45:00 | CuriousLearner | set | nosy: + CuriousLearnermessages: + |
2016-02-22 09:26:51 | piotr.dobrogost | set | nosy: + piotr.dobrogost |
2013-12-17 12:48:44 | ncoghlan | set | messages: + |
2013-12-14 13:22:30 | ncoghlan | link | issue19978 dependencies |
2013-12-14 13:22:13 | ncoghlan | set | dependencies: + Update runpy for PEP 451 |
2013-12-14 13:22:03 | ncoghlan | create |