M7350/oe-core/meta/recipes-devtools/python/python3/04-default-is-optimized.patch
2024-09-09 08:57:42 +00:00

59 lines
1.9 KiB
Diff

Upstream-Status: Inappropriate [embedded specific]
Updated original patch for python 2.7.3
Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
2012/05/01
# 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>
Index: Python-3.2.3/Python/compile.c
===================================================================
--- Python-3.2.3.orig/Python/compile.c 2012-04-10 23:54:08.000000000 -0700
+++ Python-3.2.3/Python/compile.c 2012-09-19 15:58:46.649123998 -0700
@@ -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.2.3/Modules/main.c
===================================================================
--- Python-3.2.3.orig/Modules/main.c 2012-04-10 23:54:07.000000000 -0700
+++ Python-3.2.3/Modules/main.c 2012-09-19 16:00:32.153124053 -0700
@@ -46,7 +46,7 @@
static int orig_argc;
/* command line options */
-#define BASE_OPTS L"bBc:dEhiJm:OqRsStuvVW:xX:?"
+#define BASE_OPTS L"bBc:dEhiJm:NOqRsStuvVW:xX:?"
#define PROGRAM_OPTS BASE_OPTS
@@ -71,6 +71,7 @@
-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\
-R : use a pseudo-random salt to make hash() values of various types be\n\
unpredictable between separate invocations of the interpreter, as\n\
@@ -407,8 +408,8 @@
/* case 'J': reserved for Jython */
- case 'O':
- Py_OptimizeFlag++;
+ case 'N':
+ Py_OptimizeFlag=0;
break;
case 'B':