mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Handle importing pkg.mod by executing
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
This commit is contained in:
parent
59f9c3affc
commit
49f8d8b016
4 changed files with 276 additions and 253 deletions
|
|
@ -1083,7 +1083,7 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=0):
|
|||
return module
|
||||
else:
|
||||
cut_off = len(name) - len(name.partition('.')[0])
|
||||
return sys.modules[module.__name__[:-cut_off]]
|
||||
return sys.modules[module.__name__[:len(module.__name__)-cut_off]]
|
||||
else:
|
||||
return _handle_fromlist(module, fromlist, _gcd_import)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue