Skip to content

Commit 5acbd89

Browse files
Make PYTHONINSPECT check consistent (switch it around this time)
1 parent 89db200 commit 5acbd89

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Modules/main.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,8 @@ pymain_repl(PyConfig *config, int *exitcode)
576576
{
577577
/* Check this environment variable at the end, to give programs the
578578
opportunity to set it from Python. */
579-
if (!config->inspect) {
580-
int inspect_env = 0;
581-
_Py_get_env_flag(config->use_environment, &inspect_env, "PYTHONINSPECT");
582-
if (inspect_env) {
583-
pymain_set_inspect(config, 1);
584-
}
579+
if (!config->inspect && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) {
580+
pymain_set_inspect(config, 1);
585581
}
586582

587583
if (!(config->inspect && stdin_is_interactive(config) && config_run_code(config))) {

Python/initconfig.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,9 @@ config_read_env_vars(PyConfig *config)
18461846
_Py_get_env_flag(use_env, &config->parser_debug, "PYTHONDEBUG");
18471847
_Py_get_env_flag(use_env, &config->verbose, "PYTHONVERBOSE");
18481848
_Py_get_env_flag(use_env, &config->optimization_level, "PYTHONOPTIMIZE");
1849-
_Py_get_env_flag(use_env, &config->inspect, "PYTHONINSPECT");
1849+
if (_Py_GetEnv(use_env, "PYTHONINSPECT")) {
1850+
config->inspect = 1;
1851+
}
18501852

18511853
int dont_write_bytecode = 0;
18521854
_Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");

0 commit comments

Comments
 (0)