[Python-checkins] cpython (merge 3.4 -> default): Merge for issue #20884

brett.cannon python-checkins at python.org
Fri Mar 21 16:02:54 CET 2014


http://hg.python.org/cpython/rev/42ae7b2524a2
changeset: 89901:42ae7b2524a2
parent: 89899:455e5385752a
parent: 89900:b5b81a3eb6e6
user: Brett Cannon <brett at python.org>
date: Fri Mar 21 11:01:02 2014 -0400
summary:
 Merge for issue #20884
files:
 Lib/importlib/__init__.py | 7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -22,7 +22,12 @@
 # a second copy of the module.
 _bootstrap.__name__ = 'importlib._bootstrap'
 _bootstrap.__package__ = 'importlib'
- _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
+ try:
+ _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
+ except NameError:
+ # __file__ is not guaranteed to be defined, e.g. if this code gets
+ # frozen by a tool like cx_Freeze.
+ pass
 sys.modules['importlib._bootstrap'] = _bootstrap
 
 # To simplify imports in test code
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /