Skip to content
Permalink
Browse files

bpo-34170: Py_Main() updates config when setting Py_InspectFlag (GH-8593

)
  • Loading branch information...
vstinner committed Aug 1, 2018
1 parent b75d7e2 commit a4d20b2e5ece2120f129cb4dda951a6c2461e92d
Showing with 3 additions and 0 deletions.
  1. +3 −0 Modules/main.c
@@ -1588,6 +1588,7 @@ pymain_run_filename(_PyMain *pymain, _PyCoreConfig *config,
{
if (pymain->filename == NULL && pymain->stdin_is_interactive) {
Py_InspectFlag = 0; /* do exit on SystemExit */
config->inspect = 0;
pymain_run_startup(pymain, config, cf);
pymain_run_interactive_hook();
}
@@ -1614,13 +1615,15 @@ pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf)
opportunity to set it from Python. */
if (!Py_InspectFlag && config_get_env_var(config, "PYTHONINSPECT")) {
Py_InspectFlag = 1;
config->inspect = 1;
}

if (!(Py_InspectFlag && pymain->stdin_is_interactive && RUN_CODE(pymain))) {
return;
}

Py_InspectFlag = 0;
config->inspect = 0;
pymain_run_interactive_hook();

int res = PyRun_AnyFileFlags(stdin, "<stdin>", cf);

0 comments on commit a4d20b2

Please sign in to comment.
You can’t perform that action at this time.