|
/* Envvars that don't have equivalent command-line options are listed first */ |
|
static const char usage_envvars[] = |
|
"Environment variables that change behavior:\n" |
|
"PYTHONSTARTUP : file executed on interactive startup (no default)\n" |
|
"PYTHONPATH : '%lc'-separated list of directories prefixed to the\n" |
|
" default module search path. The result is sys.path.\n" |
|
"PYTHONHOME : alternate <prefix> directory (or <prefix>%lc<exec_prefix>).\n" |
|
" The default module search path uses %s.\n" |
|
"PYTHONPLATLIBDIR: override sys.platlibdir\n" |
|
"PYTHONCASEOK : ignore case in 'import' statements (Windows)\n" |
|
"PYTHONIOENCODING: encoding[:errors] used for stdin/stdout/stderr\n" |
|
"PYTHONHASHSEED : if this variable is set to 'random', a random value is used\n" |
|
" to seed the hashes of str and bytes objects. It can also be\n" |
|
" set to an integer in the range [0,4294967295] to get hash\n" |
|
" values with a predictable seed.\n" |
|
"PYTHONMALLOC : set the Python memory allocators and/or install debug hooks\n" |
|
" on Python memory allocators. Use PYTHONMALLOC=debug to\n" |
|
" install debug hooks.\n" |
|
"PYTHONCOERCECLOCALE: if this variable is set to 0, it disables the locale\n" |
|
" coercion behavior. Use PYTHONCOERCECLOCALE=warn to request\n" |
|
" display of locale coercion and locale compatibility warnings\n" |
|
" on stderr.\n" |
|
"PYTHONBREAKPOINT: if this variable is set to 0, it disables the default\n" |
|
" debugger. It can be set to the callable of your debugger of\n" |
|
" choice.\n" |
|
"PYTHON_COLORS : if this variable is set to 1, the interpreter will colorize\n" |
|
" various kinds of output. Setting it to 0 deactivates\n" |
|
" this behavior.\n" |
|
"PYTHON_HISTORY : the location of a .python_history file.\n" |
|
"\n" |
|
"These variables have equivalent command-line options (see --help for details):\n" |
|
"PYTHON_CPU_COUNT: override the return value of os.cpu_count() (-X cpu_count)\n" |
|
"PYTHONDEBUG : enable parser debug mode (-d)\n" |
|
"PYTHONDEVMODE : enable Python Development Mode (-X dev)\n" |
|
"PYTHONDONTWRITEBYTECODE: don't write .pyc files (-B)\n" |
|
"PYTHONFAULTHANDLER: dump the Python traceback on fatal errors (-X faulthandler)\n" |
|
"PYTHON_FROZEN_MODULES: whether to use frozen modules; the default is \"on\"\n" |
|
" for installed Python and \"off\" for a local build\n" |
|
" (-X frozen_modules)\n" |
|
#ifdef Py_GIL_DISABLED |
|
"PYTHON_GIL : when set to 0, disables the GIL (-X gil)\n" |
|
#endif |
|
"PYTHONINSPECT : inspect interactively after running script (-i)\n" |
|
"PYTHONINTMAXSTRDIGITS: limit the size of int<->str conversions;\n" |
|
" 0 disables the limit (-X int_max_str_digits=N)\n" |
|
"PYTHONNODEBUGRANGES: don't include extra location information in code objects\n" |
|
" (-X no_debug_ranges)\n" |
|
"PYTHONNOUSERSITE: disable user site directory (-s)\n" |
|
"PYTHONOPTIMIZE : enable level 1 optimizations (-O)\n" |
|
"PYTHONPERFSUPPORT: support the Linux \"perf\" profiler (-X perf)\n" |
|
#ifdef Py_DEBUG |
|
"PYTHON_PRESITE: import this module before site (-X presite)\n" |
|
#endif |
|
"PYTHONPROFILEIMPORTTIME: show how long each import takes (-X importtime)\n" |
|
"PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files\n" |
|
" (-X pycache_prefix)\n" |
|
"PYTHONSAFEPATH : don't prepend a potentially unsafe path to sys.path.\n" |
|
#ifdef Py_STATS |
|
"PYTHONSTATS : turns on statistics gathering (-X pystats)\n" |
|
#endif |
|
"PYTHONTRACEMALLOC: trace Python memory allocations (-X tracemalloc)\n" |
|
"PYTHONUNBUFFERED: disable stdout/stderr buffering (-u)\n" |
|
"PYTHONUTF8 : control the UTF-8 mode (-X utf8)\n" |
|
"PYTHONVERBOSE : trace import statements (-v)\n" |
|
"PYTHONWARNDEFAULTENCODING: enable opt-in EncodingWarning for 'encoding=None'\n" |
|
" (-X warn_default_encoding)\n" |
|
"PYTHONWARNINGS : warning control (-W)\n" |
|
; |
Documentation
While looking for ways to control the new REPL, I found that
PYTHON_BASIC_REPLinfluences it, but is not present in the output of--help-env.Here's a list of environment variables that are present in the documentation but missing from
--help-envininitconfig.c:PYTHONASYNCIODEBUGPYTHONDUMPREFSPYTHONDUMPREFSFILEPYTHONEXECUTABLEPYTHONLEGACYWINDOWSFSENCODINGPYTHONLEGACYWINDOWSSTDIOPYTHONMALLOCSTATSPYTHONUSERBASEPYTHON_BASIC_REPLPYTHON_PERF_JIT_SUPPORTThe environment variable
PYTHONSTATSis present ininitconfig.cbut missing from the docs.Here's the part of
initconfig.cwith the content of--help-env:cpython/Python/initconfig.c
Lines 234 to 301 in d25954d
I did a search to figure out if these are intentionally missing, but wasn't able to find out.
Linked PRs