Commit a4d20b2e authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

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

parent b75d7e24
...@@ -1588,6 +1588,7 @@ pymain_run_filename(_PyMain *pymain, _PyCoreConfig *config, ...@@ -1588,6 +1588,7 @@ pymain_run_filename(_PyMain *pymain, _PyCoreConfig *config,
{ {
if (pymain->filename == NULL && pymain->stdin_is_interactive) { if (pymain->filename == NULL && pymain->stdin_is_interactive) {
Py_InspectFlag = 0; /* do exit on SystemExit */ Py_InspectFlag = 0; /* do exit on SystemExit */
config->inspect = 0;
pymain_run_startup(pymain, config, cf); pymain_run_startup(pymain, config, cf);
pymain_run_interactive_hook(); pymain_run_interactive_hook();
} }
...@@ -1614,6 +1615,7 @@ pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf) ...@@ -1614,6 +1615,7 @@ pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf)
opportunity to set it from Python. */ opportunity to set it from Python. */
if (!Py_InspectFlag && config_get_env_var(config, "PYTHONINSPECT")) { if (!Py_InspectFlag && config_get_env_var(config, "PYTHONINSPECT")) {
Py_InspectFlag = 1; Py_InspectFlag = 1;
config->inspect = 1;
} }
if (!(Py_InspectFlag && pymain->stdin_is_interactive && RUN_CODE(pymain))) { if (!(Py_InspectFlag && pymain->stdin_is_interactive && RUN_CODE(pymain))) {
...@@ -1621,6 +1623,7 @@ pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf) ...@@ -1621,6 +1623,7 @@ pymain_repl(_PyMain *pymain, _PyCoreConfig *config, PyCompilerFlags *cf)
} }
Py_InspectFlag = 0; Py_InspectFlag = 0;
config->inspect = 0;
pymain_run_interactive_hook(); pymain_run_interactive_hook();
int res = PyRun_AnyFileFlags(stdin, "<stdin>", cf); int res = PyRun_AnyFileFlags(stdin, "<stdin>", cf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment