mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +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
10
Python/executor_cases.c.h
generated
10
Python/executor_cases.c.h
generated
|
@ -4426,15 +4426,10 @@
|
|||
PyObject *exit_func_o = PyStackRef_AsPyObjectBorrow(exit_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 {
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
Py_DECREF(tb);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
}
|
||||
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};
|
||||
|
@ -4446,6 +4441,9 @@
|
|||
if (res_o == NULL) {
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
Py_XDECREF(original_tb);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
stack_pointer[0] = res;
|
||||
stack_pointer += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue