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 ronaldoussoren
Recipients corona10, ronaldoussoren, serhiy.storchaka, vstinner
Date 2021-01-19.11:18:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>> Wouldn't it be sufficient to somehow mark the stdlib entries on sys.path? Although that might give misleading answers with tools like pyinstaller/py2exe/py2app that package an application and its dependencies into a single zipfile.

> Having to actually import modules to check if it's a stdlib module or not is not convenient. Many stdlib modules have side effects on import. For example, "import antigravity" opens a web browser. An import can open files, spawn threads, run programs, etc.

You wouldn't necessarily have to import a module to test, this is something that could be added to importlib.  One (poorly thought out) option is to add sys._stdlib_path with the subsection of sys.path that contains the stdlib, and a function in importlib that returns if a spec is for a stdlib module.

The disadvantage of this, or for the most part anything but your initial proposal, is that might not be save to use a function in importlib in Py_FatalError.
Date User Action Args
2021-01-19 11:18:36ronaldoussorensetrecipients: + ronaldoussoren, vstinner, serhiy.storchaka, corona10
2021-01-19 11:18:36ronaldoussorensetmessageid: <>
2021-01-19 11:18:36ronaldoussorenlinkissue42955 messages
2021-01-19 11:18:36ronaldoussorencreate