mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-130595: Keep traceback alive for WITH_EXCEPT_START (#130562)
Keep traceback alive for WITH_EXCEPT_START
This commit is contained in:
parent
9e474a98af
commit
5c8e8704c3
3 changed files with 10 additions and 16 deletions
|
@ -3297,13 +3297,10 @@ dummy_func(
|
|||
|
||||
assert(val_o && PyExceptionInstance_Check(val_o));
|
||||
exc = PyExceptionInstance_Class(val_o);
|
||||
tb = PyException_GetTraceback(val_o);
|
||||
PyObject *original_tb = tb = PyException_GetTraceback(val_o);
|
||||
if (tb == NULL) {
|
||||
tb = Py_None;
|
||||
}
|
||||
else {
|
||||
Py_DECREF(tb);
|
||||
}
|
||||
assert(PyStackRef_LongCheck(lasti));
|
||||
(void)lasti; // Shut up compiler warning if asserts are off
|
||||
PyObject *stack[5] = {NULL, PyStackRef_AsPyObjectBorrow(exit_self), exc, val_o, tb};
|
||||
|
@ -3311,6 +3308,7 @@ dummy_func(
|
|||
PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
|
||||
(3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
||||
ERROR_IF(res_o == NULL, error);
|
||||
Py_XDECREF(original_tb);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue