mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-102778: Add sys.last_exc, deprecate sys.last_type, sys.last_value,sys.last_traceback (#102779)
This commit is contained in:
parent
039714d00f
commit
e1e9bab006
22 changed files with 103 additions and 36 deletions
|
@ -776,6 +776,10 @@ _PyErr_PrintEx(PyThreadState *tstate, int set_sys_last_vars)
|
|||
}
|
||||
|
||||
if (set_sys_last_vars) {
|
||||
if (_PySys_SetAttr(&_Py_ID(last_exc), exc) < 0) {
|
||||
_PyErr_Clear(tstate);
|
||||
}
|
||||
/* Legacy version: */
|
||||
if (_PySys_SetAttr(&_Py_ID(last_type), typ) < 0) {
|
||||
_PyErr_Clear(tstate);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue