summaryrefslogtreecommitdiffstats
path: root/Tools/freeze
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-23 14:39:05 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-23 14:39:05 (GMT)
commit1abfb9c0f5af3727dfa09023a85834e40bba1cf3 (patch)
treed253527cdeda1a192e8c75fb4269cf61557644c2 /Tools/freeze
parentdf1940717d4308335454732a3c9e54ab91af056d (diff)
downloadcpython-1abfb9c0f5af3727dfa09023a85834e40bba1cf3.zip
cpython-1abfb9c0f5af3727dfa09023a85834e40bba1cf3.tar.gz
cpython-1abfb9c0f5af3727dfa09023a85834e40bba1cf3.tar.bz2
If freezing with the -O option, the optimized bytecode files are
used. It is useful to implicitly set the -O flag in the frozen application. (Sjoerd Mullender)
Diffstat (limited to 'Tools/freeze')
-rw-r--r--Tools/freeze/makefreeze.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py
index 25c52bc..29f91ac 100644
--- a/Tools/freeze/makefreeze.py
+++ b/Tools/freeze/makefreeze.py
@@ -14,12 +14,16 @@ trailer = """\
};
"""
+# if __debug__ == 0 (i.e. -O option given), set Py_OptimizeFlag in frozen app.
default_entry_point = """
int
main(argc, argv)
int argc;
char **argv;
{
+""" + ((not __debug__ and """
+ Py_OptimizeFlag++;
+""") or "") + """
PyImport_FrozenModules = _PyImport_FrozenModules;
return Py_FrozenMain(argc, argv);
}