Found when testing PYTHONINSPECT for #143134, when you set PYTHONINSPECT to a "non-empty" string that is 0, it is checked in initconfig.c with _Py_get_env_flag:
Line 1849 in fc2f0fe
| _Py_get_env_flag(use_env, &config->inspect, "PYTHONINSPECT"); |
But then directly with _Py_GetEnv in pymain_repl:
Lines 579 to 581 in fc2f0fe
| if (!config->inspect && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) { | |
| pymain_set_inspect(config, 1); | |
| } |
So, you end up in this situation:
$ PYTHONINSPECT=0 ./python -c "import sys; print(sys.flags.inspect)"
0
>>> # We still inspect, even though sys.flags.inspect is not set...