Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4c31791

Browse filesBrowse files
authored
GH-120024: Move three more escaping calls out of conditional statements (GH-122734)
1 parent 8ce70d6 commit 4c31791
Copy full SHA for 4c31791

File tree

Expand file treeCollapse file tree

3 files changed

+32
-10
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-10
lines changed

‎Python/bytecodes.c

Copy file name to clipboardExpand all lines: Python/bytecodes.c
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ dummy_func(
191191
uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK;
192192
uintptr_t code_version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version);
193193
if (code_version != global_version && tstate->tracing == 0) {
194-
if (_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp)) {
194+
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
195+
if (err) {
195196
ERROR_NO_POP();
196197
}
197198
next_instr = this_instr;
@@ -1802,7 +1803,12 @@ dummy_func(
18021803
assert(PyDict_CheckExact(dict));
18031804
/* dict[key] = value */
18041805
// Do not DECREF INPUTS because the function steals the references
1805-
ERROR_IF(_PyDict_SetItem_Take2((PyDictObject *)dict, PyStackRef_AsPyObjectSteal(key), PyStackRef_AsPyObjectSteal(value)) != 0, error);
1806+
int err = _PyDict_SetItem_Take2(
1807+
(PyDictObject *)dict,
1808+
PyStackRef_AsPyObjectSteal(key),
1809+
PyStackRef_AsPyObjectSteal(value)
1810+
);
1811+
ERROR_IF(err != 0, error);
18061812
}
18071813

18081814
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/1, unused, unused, unused -- unused, unused if (oparg & 1))) {
@@ -2455,7 +2461,8 @@ dummy_func(
24552461
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
24562462

24572463
assert(PyExceptionInstance_Check(left_o));
2458-
if (_PyEval_CheckExceptTypeValid(tstate, right_o) < 0) {
2464+
int err = _PyEval_CheckExceptTypeValid(tstate, right_o);
2465+
if (err < 0) {
24592466
DECREF_INPUTS();
24602467
ERROR_IF(true, error);
24612468
}
@@ -4107,7 +4114,8 @@ dummy_func(
41074114
// It converts all dict subtypes in kwargs into regular dicts.
41084115
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
41094116
if (!PyTuple_CheckExact(callargs)) {
4110-
if (check_args_iterable(tstate, func, callargs) < 0) {
4117+
int err = check_args_iterable(tstate, func, callargs);
4118+
if (err < 0) {
41114119
ERROR_NO_POP();
41124120
}
41134121
PyObject *tuple = PySequence_Tuple(callargs);

‎Python/executor_cases.c.h

Copy file name to clipboardExpand all lines: Python/executor_cases.c.h
+8-2Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Python/generated_cases.c.h

Copy file name to clipboardExpand all lines: Python/generated_cases.c.h
+12-4Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.