Skip to content

Commit

Permalink
Py_Main(): Add a check for the PYTHONINSPECT environment variable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
warsaw committed Jun 29, 2003
1 parent e3a565e commit d86dcd3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,15 @@ Py_Main(int argc, char **argv)
filename != NULL, &cf) != 0;
}

/* Check this environment variable at the end, to give programs the
* opportunity to set it from Python.
*/
if (!saw_inspect_flag &&
(p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
{
inspect = 1;
}

if (inspect && stdin_is_interactive &&
(filename != NULL || command != NULL))
/* XXX */
Expand Down

0 comments on commit d86dcd3

Please sign in to comment.