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 eric.snow
Recipients brett.cannon, eric.snow, ncoghlan
Date 2016-03-17.18:19:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458238800.08.0.676127110581.issue26584@psf.upfronthosting.co.za>
In-reply-to
Content
(see issue26569)

The pyclbr module is showing its age (born 1995).  It assumes there are only 2 module types (builtin and source-based), particularly in readmodule() and readmodule_ex().  Really it should be source-based and "everything else".

For instance, it does not handle namespace packages correctly, since the spec.loader is set to None there.  It also doesn't handle frozen modules (e.g. "./python Lib/pyclbr.py _frozen_importlib").  This is likewise a problem for other/custom loaders that don't match the expectations of pyclbr.

Here are some things that should be done:

* replace custom introspection code with newer tools like importlib.util.module_from_spec()
* special-case namespace modules (since their spec.loader is None); this is probably a moot point if module_from_spec() gets used
* ignore more than just builtins; explicitly check for importlib.abc.SourceLoader?
* make use of similar tools in the inspect module?
History
Date User Action Args
2016-03-17 18:20:00eric.snowsetrecipients: + eric.snow, brett.cannon, ncoghlan
2016-03-17 18:20:00eric.snowsetmessageid: <1458238800.08.0.676127110581.issue26584@psf.upfronthosting.co.za>
2016-03-17 18:19:59eric.snowlinkissue26584 messages
2016-03-17 18:19:59eric.snowcreate