mirror of
https://github.com/python/cpython.git
synced 2025-10-06 07:02:33 +00:00
[3.6] bpo-30817: Fix PyErr_PrintEx() when no memory (GH-2526). (#4107)
(cherry picked from commit 66caacf2f0
)
This commit is contained in:
parent
d8f78a1fbc
commit
d5d79545b7
3 changed files with 29 additions and 4 deletions
|
@ -624,9 +624,15 @@ PyErr_PrintEx(int set_sys_last_vars)
|
|||
return;
|
||||
/* Now we know v != NULL too */
|
||||
if (set_sys_last_vars) {
|
||||
_PySys_SetObjectId(&PyId_last_type, exception);
|
||||
_PySys_SetObjectId(&PyId_last_value, v);
|
||||
_PySys_SetObjectId(&PyId_last_traceback, tb);
|
||||
if (_PySys_SetObjectId(&PyId_last_type, exception) < 0) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (_PySys_SetObjectId(&PyId_last_value, v) < 0) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (_PySys_SetObjectId(&PyId_last_traceback, tb) < 0) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
}
|
||||
hook = _PySys_GetObjectId(&PyId_excepthook);
|
||||
if (hook) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue