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 <1611055116.78.0.871884800721.issue42955@roundup.psfhosted.org>
In-reply-to
Content
>> 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.
History
Date User Action Args
2021-01-19 11:18:36ronaldoussorensetrecipients: + ronaldoussoren, vstinner, serhiy.storchaka, corona10
2021-01-19 11:18:36ronaldoussorensetmessageid: <1611055116.78.0.871884800721.issue42955@roundup.psfhosted.org>
2021-01-19 11:18:36ronaldoussorenlinkissue42955 messages
2021-01-19 11:18:36ronaldoussorencreate