[Python-checkins] cpython: Don't overwrite a __path__ value from extension modules if already
brett.cannon
python-checkins at python.org
Sun Aug 12 01:43:54 CEST 2012
http://hg.python.org/cpython/rev/34d5ec8a1019
changeset: 78511:34d5ec8a1019
user: Brett Cannon <brett at python.org>
date: Sat Aug 11 19:43:29 2012 -0400
summary:
Don't overwrite a __path__ value from extension modules if already
set.
files:
Lib/importlib/_bootstrap.py | 2 +-
Python/importlib.h | 3341 +++++++++++-----------
2 files changed, 1673 insertions(+), 1670 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1108,7 +1108,7 @@
module = _call_with_frames_removed(_imp.load_dynamic,
fullname, self.path)
_verbose_message('extension module loaded from {!r}', self.path)
- if self.is_package(fullname):
+ if self.is_package(fullname) and not hasattr(module, '__path__'):
module.__path__ = [_path_split(self.path)[0]]
return module
except:
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list