Skip to content

Commit

Permalink
[3.12] pythongh-121735: Fix module-adjacent references in zip files
Browse files Browse the repository at this point in the history
Applying the fix only and not the refactoring of the test suite.
  • Loading branch information
jaraco committed Sep 12, 2024
1 parent 4514998 commit c6dfba2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/importlib/resources/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ def files(self):

class ZipReader(abc.TraversableResources):
def __init__(self, loader, module):
_, _, name = module.rpartition('.')
self.prefix = loader.prefix.replace('\\', '/') + name + '/'
self.prefix = loader.prefix.replace('\\', '/')
if loader.is_package(module):
_, _, name = module.rpartition('.')
self.prefix += name + '/'
self.archive = loader.archive

def open_resource(self, resource):
Expand Down

0 comments on commit c6dfba2

Please sign in to comment.