Browse Source

python3: disable Python3 bytecode generation by default

Same as python.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Alexandru Ardelean 10 years ago
parent
commit
48aaf18057
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      lang/python3/patches/140-do-not-write-bytes-codes.patch

+ 22
- 0
lang/python3/patches/140-do-not-write-bytes-codes.patch View File

@@ -0,0 +1,22 @@
1
+diff --git a/Python/pythonrun.c b/Python/pythonrun.c
2
+index 0327830..df41cda 100644
3
+--- a/Python/pythonrun.c
4
++++ b/Python/pythonrun.c
5
+@@ -124,7 +124,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
6
+ int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
7
+ int Py_NoSiteFlag; /* Suppress 'import site' */
8
+ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
9
+-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
10
++int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
11
+ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
12
+ int Py_FrozenFlag; /* Needed by getpath.c */
13
+ int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
14
+@@ -350,7 +350,7 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
15
+     if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
16
+         Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
17
+     if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
18
+-        Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
19
++        Py_DontWriteBytecodeFlag = atoi(p);
20
+     /* The variable is only tested for existence here; _PyRandom_Init will
21
+        check its value further. */
22
+     if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')