mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-46202: Remove opcode POP_EXCEPT_AND_RERAISE (GH-30302)
* bpo-46202: remove opcode POP_EXCEPT_AND_RERAISE * do not assume that an exception group is truthy
This commit is contained in:
parent
a09062c267
commit
a94461d718
11 changed files with 138 additions and 146 deletions
|
@ -2725,31 +2725,6 @@ check_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(POP_EXCEPT_AND_RERAISE) {
|
||||
PyObject *lasti = PEEK(2);
|
||||
if (PyLong_Check(lasti)) {
|
||||
frame->f_lasti = PyLong_AsLong(lasti);
|
||||
assert(!_PyErr_Occurred(tstate));
|
||||
}
|
||||
else {
|
||||
_PyErr_SetString(tstate, PyExc_SystemError, "lasti is not an int");
|
||||
goto error;
|
||||
}
|
||||
PyObject *value = POP();
|
||||
assert(value);
|
||||
assert(PyExceptionInstance_Check(value));
|
||||
PyObject *type = Py_NewRef(PyExceptionInstance_Class(value));
|
||||
PyObject *traceback = PyException_GetTraceback(value);
|
||||
Py_DECREF(POP()); /* lasti */
|
||||
_PyErr_Restore(tstate, type, value, traceback);
|
||||
|
||||
_PyErr_StackItem *exc_info = tstate->exc_info;
|
||||
value = exc_info->exc_value;
|
||||
exc_info->exc_value = POP();
|
||||
Py_XDECREF(value);
|
||||
goto exception_unwind;
|
||||
}
|
||||
|
||||
TARGET(RERAISE) {
|
||||
if (oparg) {
|
||||
PyObject *lasti = PEEK(oparg + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue