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:
Irit Katriel 2022-01-04 10:37:12 +00:00 committed by GitHub
parent a09062c267
commit a94461d718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 138 additions and 146 deletions

View file

@ -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);