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 vstinner
Recipients corona10, ronaldoussoren, serhiy.storchaka, vstinner
Date 2021-01-19.16:35:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611074133.27.0.657326178455.issue42955@roundup.psfhosted.org>
In-reply-to
Content
Ronald:
> I think we agree on that point: my counter proposal won’t work in the faulthandler scenario, and may be problematic in the Py_FatalError case as well.

The API providing a tuple of str (sys.module_names) works with the 4 use cases that I listed:

* faulthandler/Py_FatalError (dump third party extensions of sys.modules)
* isort (group stdlib imports)
* trace (don't trace stdlib modules)
* pypt (ignore stdlib modules when computing dependencies)


Ronald:
> Although that might give misleading answers with tools like pyinstaller/py2exe/py2app that package an application and its dependencies into a single zipfile.

These tools worked for years without sys.module_names and don't need to be modified to use sys.module_names.

sys.module_names is well defined, extract of its doc:

"The list is the same on all platforms. Modules which are not available on some platforms and modules disabled at Python build are also listed."

These packaging tools may require further checks than just checking if the name is in sys.module_names. These tools are complex anyway ;-)
History
Date User Action Args
2021-01-19 16:35:33vstinnersetrecipients: + vstinner, ronaldoussoren, serhiy.storchaka, corona10
2021-01-19 16:35:33vstinnersetmessageid: <1611074133.27.0.657326178455.issue42955@roundup.psfhosted.org>
2021-01-19 16:35:33vstinnerlinkissue42955 messages
2021-01-19 16:35:33vstinnercreate