deploy-stub: Set Py_OptimizeFlag to 2 for Python 3.2+

This fixes the value of `sys.flags.optimize`, as we always build Python code with `optimize=2` in Python 3.2 and above

In the long run we need a better solution, see #1363

Closes #1359
Fixes #1343
This commit is contained in:
rdb 2022-08-31 11:15:27 +02:00
parent 8617eb917c
commit 3e220e4fb4

View File

@ -441,6 +441,10 @@ int Py_FrozenMain(int argc, char **argv)
Py_NoSiteFlag = 0;
Py_NoUserSiteDirectory = 1;
#if PY_VERSION_HEX >= 0x03020000
Py_OptimizeFlag = 2;
#endif
#ifndef NDEBUG
if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
inspect = 1;