[issue26569] pyclbr.readmodule() and pyclbr.readmodule_ex() don't support packages

STINNER Victor report at bugs.python.org
Wed Mar 16 19:16:55 EDT 2016


STINNER Victor added the comment:

>Hmm. These two should be equivalent:
> if spec.loader.is_package(fullmodule): ...

The problem is that spec.loader is None when test is a package.

It's easy to reproduce the issue:

$ rm -f Lib/test/__init__.py Lib/test/__pycache__/__init__.cpython-36.pyc
$ ./python -m test -v -m test_decorators test_pyclbr
..
======================================================================
ERROR: test_decorators (test.test_pyclbr.PyclbrTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  ...
  File "/home/haypo/prog/python/default/Lib/pyclbr.py", line 145, in _readmodule
    fname = spec.loader.get_filename(fullmodule)
AttributeError: 'NoneType' object has no attribute 'get_filename'

----------

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


More information about the Python-bugs-list mailing list