summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/04-default-is-optimized.patch
blob: 3b8f264a5810716915dcc7c8d41bf582d8afa97f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Upstream-Status: Inappropriate [embedded specific]

# when compiling for an embedded system, we need every bit of
# performance we can get. default to optimized with the option
# of opt-out.
# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille-media.de>


2012/05/01
Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>

Rebased for 3.4.2 02/2015
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>

Index: Python-3.4.2/Python/compile.c
===================================================================
--- Python-3.4.2.orig/Python/compile.c
+++ Python-3.4.2/Python/compile.c
@@ -30,7 +30,7 @@
 #include "symtable.h"
 #include "opcode.h"
 
-int Py_OptimizeFlag = 0;
+int Py_OptimizeFlag = 1;
 
 #define DEFAULT_BLOCK_SIZE 16
 #define DEFAULT_BLOCKS 8
Index: Python-3.4.2/Modules/main.c
===================================================================
--- Python-3.4.2.orig/Modules/main.c
+++ Python-3.4.2/Modules/main.c
@@ -38,7 +38,7 @@ static wchar_t **orig_argv;
 static int  orig_argc;
 
 /* command line options */
-#define BASE_OPTS L"bBc:dEhiIJm:OqRsStuvVW:xX:?"
+#define BASE_OPTS L"bBc:dEhiIJm:NOqRsStuvVW:xX:?"
 
 #define PROGRAM_OPTS BASE_OPTS
 
@@ -64,6 +64,7 @@ static char *usage_2 = "\
 -m mod : run library module as a script (terminates option list)\n\
 -O     : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
 -OO    : remove doc-strings in addition to the -O optimizations\n\
+-N     : do NOT optimize generated bytecode\n\
 -q     : don't print version and copyright messages on interactive startup\n\
 -s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
 -S     : don't imply 'import site' on initialization\n\
@@ -418,8 +419,8 @@ Py_Main(int argc, wchar_t **argv)
 
         /* case 'J': reserved for Jython */
 
-        case 'O':
-            Py_OptimizeFlag++;
+        case 'N':
+            Py_OptimizeFlag=0;
             break;
 
         case 'B':