Skip to content

Commit 660fd5a

Browse files
authored
Fix get_code on ModuleDirImport (#226)
* Fix get_code on ModuleDirImport * version
1 parent b4156bf commit 660fd5a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tools/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 1.5.5
2+
-------------
3+
* Fix get_code on ModuleDirImport (#226)
4+
15
Version 1.5.4
26
-------------
37
* Handle packages with hyphenated names when loading distribution metadata (#224)

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.4
1+
1.5.5

tools/please_pex/pex/pex_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def find_spec(self, name, path, target=None):
191191

192192
def create_module(self, spec):
193193
"""Actually load a module that we said we'd handle in find_module."""
194-
module = import_module(spec.name[len(self.prefix):])
194+
module = import_module(spec.name.removeprefix(self.prefix))
195195
sys.modules[spec.name] = module
196196
return module
197197

@@ -210,7 +210,7 @@ def find_distributions(self, context):
210210
return itertools.chain(*self._distributions.values())
211211

212212
def get_code(self, fullname):
213-
module = self.load_module(fullname)
213+
module = import_module(fullname.removeprefix(self.prefix))
214214
return module.__loader__.get_code(fullname)
215215

216216

0 commit comments

Comments
 (0)