Documentation
PYTHONDONTWRITEBYTECODE is documented in Doc/using/cmdline.rst as:
If this is set to a non-empty string, Python won't try to write .pyc files on the import of source modules.
This is incorrect. The variable is obtained in Python/initconfig.c as:
int dont_write_bytecode = 0;
_Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");
if (dont_write_bytecode) {
config->write_bytecode = 0;
}
and _Py_get_env_flag reads the environment variable value as integer, treating non-integer string as 1. Specifically, this means that PYTHONDONTWRITEBYTECODE=0 will not suppress writing .pyc files, even though the environment variable is assigned a non-empty string "0".
Linked PRs
Documentation
PYTHONDONTWRITEBYTECODEis documented in Doc/using/cmdline.rst as:This is incorrect. The variable is obtained in Python/initconfig.c as:
and
_Py_get_env_flagreads the environment variable value as integer, treating non-integer string as1. Specifically, this means thatPYTHONDONTWRITEBYTECODE=0will not suppress writing.pycfiles, even though the environment variable is assigned a non-empty string "0".Linked PRs