This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients belopolsky, georg.brandl, ncoghlan
Date 2008-02-23.02:12:33
SpamBayes Score 2.986997e-05
Marked as misclassified No
Message-id <1203732754.6.0.469239039403.issue1877@psf.upfronthosting.co.za>
In-reply-to
Content
If main.c doesn't handle sys.exit() correctly for code run via
RunMainFromImporter, then that's a problem with the main function - it
will happen regardless of whether it is runpy.py or application code
that calls sys.exit. But as far as I can tell, it handles it just fine -
the SystemExit exception is converted to an error return from
PyObject_Call, which then flows back up the C stack as an error return
from each relevant function call in main.c (until it gets back to the
shell with a non-zero return code from the main function).

And I don't understand your complaint about the Py_None return
conflicting with the comment on that if statement: PyImport_GetImporter
will return Py_None for a directory name, as directories are handled by
the builtin machinery. If PyImport_GetImporter fails completely it will
return NULL - if the function returns anything else, then PyImport
thinks the passed in string is a legitimate sys.path entry (i.e. usable
as an import source).

The *only* difference issue3125 (or Brett's import_in_py branch) would
make to any of this is that PyImport_GetImporter won't return Py_None
anymore. In either case, the additional try/except in runpy would still
be necessary in order to intercept the ImportError when looking for the
module to be executed and convert it to something a bit more explicit.
History
Date User Action Args
2008-02-23 02:12:34ncoghlansetspambayes_score: 2.987e-05 -> 2.986997e-05
recipients: + ncoghlan, georg.brandl, belopolsky
2008-02-23 02:12:34ncoghlansetspambayes_score: 2.987e-05 -> 2.987e-05
messageid: <1203732754.6.0.469239039403.issue1877@psf.upfronthosting.co.za>
2008-02-23 02:12:34ncoghlanlinkissue1877 messages
2008-02-23 02:12:33ncoghlancreate