Nick Coghlan added the comment: 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). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19982> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com