diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py index 25c52bcf5fd..29f91acba9e 100644 --- a/Tools/freeze/makefreeze.py +++ b/Tools/freeze/makefreeze.py @@ -14,12 +14,16 @@ }; """ +# 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); }