STINNER Victor <vstin...@python.org> added the comment:

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 ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42955>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to