Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d86dcd3

Browse files
committed
Py_Main(): Add a check for the PYTHONINSPECT environment variable
after running the script so that a program could do something like: os.environ['PYTHONINSPECT'] = 1 to programmatically enter a prompt at the end. (After a patch by Skip Montanaro w/ proposal by Troy Melhase
1 parent e3a565e commit d86dcd3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Modules/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,15 @@ Py_Main(int argc, char **argv)
418418
filename != NULL, &cf) != 0;
419419
}
420420

421+
/* Check this environment variable at the end, to give programs the
422+
* opportunity to set it from Python.
423+
*/
424+
if (!saw_inspect_flag &&
425+
(p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
426+
{
427+
inspect = 1;
428+
}
429+
421430
if (inspect && stdin_is_interactive &&
422431
(filename != NULL || command != NULL))
423432
/* XXX */

0 commit comments

Comments
 (0)