mirror of
https://github.com/python/cpython.git
synced 2025-11-08 13:42:22 +00:00
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
This commit is contained in:
parent
e3a565eed0
commit
d86dcd3554
1 changed files with 9 additions and 0 deletions
|
|
@ -418,6 +418,15 @@ Py_Main(int argc, char **argv)
|
||||||
filename != NULL, &cf) != 0;
|
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 &&
|
if (inspect && stdin_is_interactive &&
|
||||||
(filename != NULL || command != NULL))
|
(filename != NULL || command != NULL))
|
||||||
/* XXX */
|
/* XXX */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue