[New-bugs-announce] [issue26569] pyclbr.readmodule() and pyclbr.readmodule_ex() doens't support packages

STINNER Victor report at bugs.python.org
Tue Mar 15 18:56:21 EDT 2016


New submission from STINNER Victor:

While working on the issue #26295 which converts the test module to a package, I noticed that pyclbr doesn't work with packages: test_pyclbr fails when test becomes a package.

Attached patch fixes pyclbr._readmodule():

* Replace "spec.loader.is_package(fullmodule)" test with "spec.submodule_search_locations is not None" to check is the module is a package
* for a package, use spec.submodule_search_locations to build __path__

I don't know importlib well enough to say if my usage of importlib spec is correct.

----------
files: pyclbr.patch
keywords: patch
messages: 261832
nosy: brett.cannon, haypo
priority: normal
severity: normal
status: open
title: pyclbr.readmodule() and pyclbr.readmodule_ex() doens't support packages
versions: Python 3.6
Added file: http://bugs.python.org/file42176/pyclbr.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26569>
_______________________________________


More information about the New-bugs-announce mailing list