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 brett.cannon, eric.snow, ncoghlan, vstinner
Date 2016-03-16.23:16:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458170215.13.0.82648717793.issue26569@psf.upfronthosting.co.za>
In-reply-to
Content
>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'
History
Date User Action Args
2016-03-16 23:16:55vstinnersetrecipients: + vstinner, brett.cannon, ncoghlan, eric.snow
2016-03-16 23:16:55vstinnersetmessageid: <1458170215.13.0.82648717793.issue26569@psf.upfronthosting.co.za>
2016-03-16 23:16:55vstinnerlinkissue26569 messages
2016-03-16 23:16:55vstinnercreate