Skip to content

Commit

Permalink
Merge pull request #301 from python/bugfix/257-multiplexed-path-params
Browse files Browse the repository at this point in the history
Fix regression and restore stdlib reader suppression on Python 3.10
  • Loading branch information
jaraco authored Mar 16, 2024
2 parents 9f5b437 + ef414ed commit c3df5a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion importlib_resources/future/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def wrapper(*args, **kwargs):
# MultiplexedPath may fail on zip subdirectory
return
# Python 3.10+
if reader.__class__.__module__.startswith('importlib.resources.'):
mod_name = reader.__class__.__module__
if mod_name.startswith('importlib.') and mod_name.endswith('readers'):
return
# Python 3.8, 3.9
if isinstance(reader, _adapters.CompatibilityFiles) and (
Expand Down
5 changes: 5 additions & 0 deletions importlib_resources/tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def test_read_text(self):
def test_traversable(self):
assert isinstance(resources.files(self.data), Traversable)

def test_joinpath_with_multiple_args(self):
files = resources.files(self.data)
binfile = files.joinpath('subdirectory', 'binary.file')
self.assertTrue(binfile.is_file())

def test_old_parameter(self):
"""
Files used to take a 'package' parameter. Make sure anyone
Expand Down
1 change: 1 addition & 0 deletions newsfragments/257.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restored expectation that stdlib readers are suppressed on Python 3.10.

0 comments on commit c3df5a9

Please sign in to comment.