Skip to content

Commit 89db200

Browse files
Make PYTHONINSPECT check consistent
1 parent fc2f0fe commit 89db200

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :envvar:`PYTHONINSPECT` to correctly treat ``0`` as false.

Modules/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,12 @@ 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 && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) {
580-
pymain_set_inspect(config, 1);
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+
}
581585
}
582586

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

0 commit comments

Comments
 (0)