diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2014-03-30 19:07:25 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2014-03-30 19:07:25 (GMT) |
commit | c00d39e96aff698a8777120f9537e261c06be0ef (patch) | |
tree | cda5f37bb98e783d7006ec064b24b8d8968247ff | |
parent | 3a4340325b153eab1f1bb1b91882d777fe6bcb21 (diff) | |
download | cpython-c00d39e96aff698a8777120f9537e261c06be0ef.zip cpython-c00d39e96aff698a8777120f9537e261c06be0ef.tar.gz cpython-c00d39e96aff698a8777120f9537e261c06be0ef.tar.bz2 |
Issue #16047: Fix module exception list and __file__ handling in freeze.
Patch by Meador Inge.
-rw-r--r-- | Lib/site.py | 11 | ||||
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rwxr-xr-x | Tools/freeze/freeze.py | 4 | ||||
-rw-r--r-- | Tools/freeze/makeconfig.py | 2 |
4 files changed, 16 insertions, 4 deletions
diff --git a/Lib/site.py b/Lib/site.py index 4fb1058..ded6539 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -364,12 +364,17 @@ def setcopyright(): builtins.credits = _sitebuiltins._Printer("credits", """\ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.""") - here = os.path.dirname(os.__file__) + files, dirs = [], [] + # Not all modules are required to have a __file__ attribute. See + # PEP 420 for more details. + if hasattr(os, '__file__'): + here = os.path.dirname(os.__file__) + files.extend(["LICENSE.txt", "LICENSE"]) + dirs.extend([os.path.join(here, os.pardir), here, os.curdir]) builtins.license = _sitebuiltins._Printer( "license", "See http://www.python.org/download/releases/%.5s/license" % sys.version, - ["LICENSE.txt", "LICENSE"], - [os.path.join(here, os.pardir), here, os.curdir]) + files, dirs) def sethelper(): @@ -137,6 +137,9 @@ Tests Tools/Demos ----------- +- Issue #16047: Fix module exception list and __file__ handling in freeze. + Patch by Meador Inge. + - Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge. - Issue #20535: PYTHONWARNING no longer affects the run_tests.py script. diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py index d0e3c3f..e0c6c2c 100755 --- a/Tools/freeze/freeze.py +++ b/Tools/freeze/freeze.py @@ -365,6 +365,10 @@ def main(): else: mf.load_file(mod) + # Alias "importlib._bootstrap" to "_frozen_importlib" so that the + # import machinery can bootstrap. + mf.modules["_frozen_importlib"] = mf.modules["importlib._bootstrap"] + # Add the main script as either __main__, or the actual module name. if python_entry_is_main: mf.run_script(scriptfile) diff --git a/Tools/freeze/makeconfig.py b/Tools/freeze/makeconfig.py index 018992c..fabaace 100644 --- a/Tools/freeze/makeconfig.py +++ b/Tools/freeze/makeconfig.py @@ -3,7 +3,7 @@ import sys # Write the config.c file -never = ['marshal', 'imp', '_ast', '__main__', 'builtins', +never = ['marshal', '_imp', '_ast', '__main__', 'builtins', 'sys', 'gc', '_warnings'] def makeconfig(infp, outfp, modules, with_ifdef=0): |