diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-07 01:38:38 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-07 01:38:38 (GMT) |
commit | eb2e0dd19d0003faf3366d648cb11d8c7218ed73 (patch) | |
tree | e1585ccfab39e660b8cdfe3366ea7b739901988f /Lib/importlib/_bootstrap.py | |
parent | 2b3849425f4d1e704060f452ec81337e0b81fc98 (diff) | |
download | cpython-eb2e0dd19d0003faf3366d648cb11d8c7218ed73.zip cpython-eb2e0dd19d0003faf3366d648cb11d8c7218ed73.tar.gz cpython-eb2e0dd19d0003faf3366d648cb11d8c7218ed73.tar.bz2 |
Move importlib's frozen importer over to rpartition for setting __package__.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index fc2a744..99fb236 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -138,10 +138,9 @@ class FrozenImporter: if cls.find_module(fullname) is None: raise ImportError("{0} is not a frozen module".format(fullname)) module = imp.init_frozen(fullname) - if hasattr(module, '__path__'): - module.__package__ = module.__name__ - elif '.' in module.__name__: - module.__package__ = module.__name__.rsplit('.', 1)[0] + module.__package__ = module.__name__ + if not hasattr(module, '__path__'): + module.__package__ = module.__package__.rpartition('.')[0] return module |