Author ncoghlan
Recipients Julian, ncoghlan
Date 2019-09-11.23:03:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568243011.89.0.742903731038.issue37941@roundup.psfhosted.org>
In-reply-to
Content
There is one, it just isn't public: runpy._run_module_as_main.

It's a private API that the -m switch implementation calls, and was introduced after the original runpy.run_module was found not to offer everything the switch needed.

It isn't possible to fully emulate -m from Python code though, as the lifecycle of the real main module is intertwined with the lifecycle of the underlying interpreter.

So if folks really want to try to do this, the source code is there to look at, but we're not giving the false impression that it's easy to do correctly with no unintended consequences.
History
Date User Action Args
2019-09-11 23:03:31ncoghlansetrecipients: + ncoghlan, Julian
2019-09-11 23:03:31ncoghlansetmessageid: <1568243011.89.0.742903731038.issue37941@roundup.psfhosted.org>
2019-09-11 23:03:31ncoghlanlinkissue37941 messages
2019-09-11 23:03:31ncoghlancreate