diff options
author | Barry Warsaw <barry@python.org> | 2003-06-29 17:07:06 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2003-06-29 17:07:06 (GMT) |
commit | d86dcd35540327ac7ba559e8c7852bd82ab84ce7 (patch) | |
tree | 756f37afb6686d6b748d0c8df840f354a7209606 /Modules/main.c | |
parent | e3a565eed0a8870e5f8b5d05040c0207ee99140f (diff) | |
download | cpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.zip cpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.tar.gz cpython-d86dcd35540327ac7ba559e8c7852bd82ab84ce7.tar.bz2 |
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
Diffstat (limited to 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c index 50440b3..83721da 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -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 */ |