Author jaraco
Recipients FFY00, barry, brett.cannon, jaraco
Date 2021-02-28.10:11:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I've pushed [this branch](, which includes fixes for the above two identified issues. Still one issue remains:

ERROR: test_package_has_no_reader_fallback (test.test_importlib.test_resource.ResourceCornerCaseTests)
Traceback (most recent call last):
  File "/Users/jaraco/code/public/cpython/Lib/test/test_importlib/", line 98, in test_package_has_no_reader_fallback
    self.assertFalse(resources.is_resource(module, 'A'))
  File "/Users/jaraco/code/public/cpython/Lib/importlib/", line 157, in is_resource
    package_contents = set(contents(package))
  File "/Users/jaraco/code/public/cpython/Lib/importlib/", line 174, in contents
    transversable = _common.from_package(package)
  File "/Users/jaraco/code/public/cpython/Lib/importlib/", line 75, in from_package
    reader = spec.loader.get_resource_reader(
AttributeError: 'object' object has no attribute 'get_resource_reader'

This same test passes on importlib_resources, and the difference seems to be rooted in how [from_package resolves the package spec using a compatibility wrapper]( On the backport, this causes the package without a resource reader to have a resource reader and return a degenerate value:

> /Users/jaraco/code/public/importlib_resources/importlib_resources/
-> package_contents = set(contents(package))
(Pdb) _common.from_package(package)
(Pdb) from . import _compat
(Pdb) _compat.package_spec(package).loader.get_resource_reader('any').files().is_dir()

This means that the compatibility shim in from_package is masking test failure in the backport, and probably the best course of action will be to unmask that failure in the backport and figure out the best behavior there.
Date User Action Args
2021-02-28 10:11:20jaracosetrecipients: + jaraco, barry, brett.cannon, FFY00
2021-02-28 10:11:19jaracosetmessageid: <>
2021-02-28 10:11:19jaracolinkissue42129 messages
2021-02-28 10:11:19jaracocreate