Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 41043:728c60e85efa legacy-trunk
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Wed, 07 Mar 2007 00:34:46 +0000 |
| parents | 5c08e6460dc5 |
| children | c8ed4aea6c58 |
line wrap: on
line diff
--- a/Python/pythonrun.c Tue Mar 06 21:15:24 2007 +0000 +++ b/Python/pythonrun.c Wed Mar 07 00:34:46 2007 +0000 @@ -69,6 +69,7 @@ int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ +int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */ int Py_NoSiteFlag; /* Suppress 'import site' */ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ int Py_FrozenFlag; /* Needed by getpath.c */ @@ -1019,6 +1020,11 @@ PyObject *exception, *value, *tb; int exitcode = 0; + if (Py_InspectFlag) + /* Don't exit if -i flag was given. This flag is set to 0 + * when entering interactive mode for inspecting. */ + return; + PyErr_Fetch(&exception, &value, &tb); if (Py_FlushLine()) PyErr_Clear();
