[Python-Dev] Draft PEP and reference implementation of a Python launcher for Windows
Nick Coghlan
ncoghlan at gmail.com
Sat Mar 19 23:51:39 CET 2011
On Sun, Mar 20, 2011 at 4:49 AM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> I, for example, will find issues with it if the implementation uses
> CreateProcess at some point - the launcher should IMO run Python
> directly, rather than creating a new process. This, in turn, will
> probably mean that you cannot actually implement the PEP in Python.
runpy performs basically that dance to implement
_run_module_as_main(), so it's definitely possible. You just need to
be careful with it, since whatever module you invoke is going to
inherit the __main__ namespace. The implementation in runpy doesn't
suffer that problem, since the interpreter imports it directly, rather
than requiring it to bootstrap itself (/tangent: I think I may have
just noticed a nasty corner case for PEP 395 to deal with...)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list