]> granicus.if.org Git - python/commitdiff
If freezing with the -O option, the optimized bytecode files are
authorGuido van Rossum <guido@python.org>
Thu, 23 Apr 1998 14:39:05 +0000 (14:39 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 23 Apr 1998 14:39:05 +0000 (14:39 +0000)
used.  It is useful to implicitly set the -O flag in the frozen
application.
(Sjoerd Mullender)

Tools/freeze/makefreeze.py

index 25c52bcf5fd1924cb02e949c6cd16dbe9e0b4918..29f91acba9e72d3ae1f87d2a491f665e1731a735 100644 (file)
@@ -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);
 }