mirror of
https://github.com/python/cpython.git
synced 2025-09-09 10:21:43 +00:00
[3.11] GH-99298: Don't perform jumps before error handling (GH-99343)
This commit is contained in:
parent
b31b64570a
commit
1119ee4f7e
2 changed files with 13 additions and 3 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
Fix an issue that could potentially cause incorrect error handling for some
|
||||||
|
bytecode instructions.
|
|
@ -2158,6 +2158,7 @@ handle_eval_breaker:
|
||||||
PyObject *container = SECOND();
|
PyObject *container = SECOND();
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_BinarySubscr(container, sub, next_instr) < 0) {
|
if (_Py_Specialize_BinarySubscr(container, sub, next_instr) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -2323,6 +2324,7 @@ handle_eval_breaker:
|
||||||
PyObject *container = SECOND();
|
PyObject *container = SECOND();
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_StoreSubscr(container, sub, next_instr) < 0) {
|
if (_Py_Specialize_StoreSubscr(container, sub, next_instr) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -3056,6 +3058,7 @@ handle_eval_breaker:
|
||||||
PyObject *name = GETITEM(names, oparg>>1);
|
PyObject *name = GETITEM(names, oparg>>1);
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name) < 0) {
|
if (_Py_Specialize_LoadGlobal(GLOBALS(), BUILTINS(), next_instr, name) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -3481,6 +3484,7 @@ handle_eval_breaker:
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_LoadAttr(owner, next_instr, name) < 0) {
|
if (_Py_Specialize_LoadAttr(owner, next_instr, name) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -3590,6 +3594,7 @@ handle_eval_breaker:
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_StoreAttr(owner, next_instr, name) < 0) {
|
if (_Py_Specialize_StoreAttr(owner, next_instr, name) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -4527,6 +4532,7 @@ handle_eval_breaker:
|
||||||
PyObject *name = GETITEM(names, oparg);
|
PyObject *name = GETITEM(names, oparg);
|
||||||
next_instr--;
|
next_instr--;
|
||||||
if (_Py_Specialize_LoadMethod(owner, next_instr, name) < 0) {
|
if (_Py_Specialize_LoadMethod(owner, next_instr, name) < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -4801,6 +4807,7 @@ handle_eval_breaker:
|
||||||
int err = _Py_Specialize_Precall(callable, next_instr, nargs,
|
int err = _Py_Specialize_Precall(callable, next_instr, nargs,
|
||||||
call_shape.kwnames, oparg);
|
call_shape.kwnames, oparg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -4822,6 +4829,7 @@ handle_eval_breaker:
|
||||||
int err = _Py_Specialize_Call(callable, next_instr, nargs,
|
int err = _Py_Specialize_Call(callable, next_instr, nargs,
|
||||||
call_shape.kwnames);
|
call_shape.kwnames);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
next_instr++;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
@ -5184,9 +5192,6 @@ handle_eval_breaker:
|
||||||
PyObject *list = SECOND();
|
PyObject *list = SECOND();
|
||||||
DEOPT_IF(!PyList_Check(list), PRECALL);
|
DEOPT_IF(!PyList_Check(list), PRECALL);
|
||||||
STAT_INC(PRECALL, hit);
|
STAT_INC(PRECALL, hit);
|
||||||
// PRECALL + CALL + POP_TOP
|
|
||||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL + 1 + INLINE_CACHE_ENTRIES_CALL + 1);
|
|
||||||
assert(_Py_OPCODE(next_instr[-1]) == POP_TOP);
|
|
||||||
PyObject *arg = POP();
|
PyObject *arg = POP();
|
||||||
if (_PyList_AppendTakeRef((PyListObject *)list, arg) < 0) {
|
if (_PyList_AppendTakeRef((PyListObject *)list, arg) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -5194,6 +5199,9 @@ handle_eval_breaker:
|
||||||
STACK_SHRINK(2);
|
STACK_SHRINK(2);
|
||||||
Py_DECREF(list);
|
Py_DECREF(list);
|
||||||
Py_DECREF(callable);
|
Py_DECREF(callable);
|
||||||
|
// PRECALL + CALL + POP_TOP
|
||||||
|
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL + 1 + INLINE_CACHE_ENTRIES_CALL + 1);
|
||||||
|
assert(_Py_OPCODE(next_instr[-1]) == POP_TOP);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue