Skip to content

Instantly share code, notes, and snippets.

@rofl0r
Created April 7, 2019 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rofl0r/45d5c22a28ba346547ab2d0bad93bd7b to your computer and use it in GitHub Desktop.
Save rofl0r/45d5c22a28ba346547ab2d0bad93bd7b to your computer and use it in GitHub Desktop.
Patch for python 2.7.15 to never write bytecode .pyc / .pyo files
--- Python-2.7.15.org/Python/pythonrun.c
+++ Python-2.7.15/Python/pythonrun.c
@@ -71,7 +71,7 @@
int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
+int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
int Py_UnicodeFlag = 0; /* Needed by compile.c */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment