[Python-Dev] runpy.py

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Aug 25 17:50:01 CEST 2009


Take a look at two PEPs referenced in runpy doc,
http://docs.python.org/3.1/library/runpy.html :

PEP 338 - Executing modules as scripts
PEP written and implemented by Nick Coghlan.
PEP 366 - Main module explicit relative imports
PEP written and implemented by Nick Coghlan.

(Nick is too modest to self-reference, but these two PEPs give an
excellent exposition. :-)

On Tue, Aug 25, 2009 at 5:01 AM, Nick Coghlan<ncoghlan at gmail.com> wrote:
> Benjamin Peterson wrote:
>> 2009/8/25 Chris Withers <chris at simplistix.co.uk>:
>>
>>> Anyway, so how is the stuff in runpy.py wired up to the command line options
>>> passed to the interpretter?
>>
>> Modules/main.c
>
> The most relevant functions in there are "RunMainFromImporter()"
> (attempting zipfile/directory execution) and "RunModule()" (-m switch
> and also called for zipfile/directory execution). The latter function
> just uses normal C API calls to actually invoke the runpy code
> (specifically "runpy._run_module_as_main()").
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
> ---------------------------------------------------------------
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/alexander.belopolsky%40gmail.com
>


More information about the Python-Dev mailing list