summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-08-06 13:14:52 (GMT)
committerGitHub <noreply@github.com>2024-08-06 13:14:52 (GMT)
commit4c317918486348ff8486168e1003be8c1daa6cf5 (patch)
tree7d7dae666c53a53f9e055f8d321cd721af6a59d2 /Python/bytecodes.c
parent8ce70d6c697c8179e007169ba2ec5d3a0dc77362 (diff)
downloadcpython-4c317918486348ff8486168e1003be8c1daa6cf5.zip
cpython-4c317918486348ff8486168e1003be8c1daa6cf5.tar.gz
cpython-4c317918486348ff8486168e1003be8c1daa6cf5.tar.bz2
GH-120024: Move three more escaping calls out of conditional statements (GH-122734)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index a8527fe..9a1af0e 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -191,7 +191,8 @@ dummy_func(
uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK;
uintptr_t code_version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version);
if (code_version != global_version && tstate->tracing == 0) {
- if (_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp)) {
+ int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
+ if (err) {
ERROR_NO_POP();
}
next_instr = this_instr;
@@ -1802,7 +1803,12 @@ dummy_func(
assert(PyDict_CheckExact(dict));
/* dict[key] = value */
// Do not DECREF INPUTS because the function steals the references
- ERROR_IF(_PyDict_SetItem_Take2((PyDictObject *)dict, PyStackRef_AsPyObjectSteal(key), PyStackRef_AsPyObjectSteal(value)) != 0, error);
+ int err = _PyDict_SetItem_Take2(
+ (PyDictObject *)dict,
+ PyStackRef_AsPyObjectSteal(key),
+ PyStackRef_AsPyObjectSteal(value)
+ );
+ ERROR_IF(err != 0, error);
}
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/1, unused, unused, unused -- unused, unused if (oparg & 1))) {
@@ -2455,7 +2461,8 @@ dummy_func(
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
assert(PyExceptionInstance_Check(left_o));
- if (_PyEval_CheckExceptTypeValid(tstate, right_o) < 0) {
+ int err = _PyEval_CheckExceptTypeValid(tstate, right_o);
+ if (err < 0) {
DECREF_INPUTS();
ERROR_IF(true, error);
}
@@ -4107,7 +4114,8 @@ dummy_func(
// It converts all dict subtypes in kwargs into regular dicts.
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
if (!PyTuple_CheckExact(callargs)) {
- if (check_args_iterable(tstate, func, callargs) < 0) {
+ int err = check_args_iterable(tstate, func, callargs);
+ if (err < 0) {
ERROR_NO_POP();
}
PyObject *tuple = PySequence_Tuple(callargs);