Skip to content

Commit c0614f3

Browse files
committed
Refactor error code paths
1 parent 7d77432 commit c0614f3

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,13 +3427,12 @@ dummy_func(
34273427
op(_LOAD_SPECIAL, (method_and_self[2] -- method_and_self[2])) {
34283428
PyObject *name = _Py_SpecialMethods[oparg].name;
34293429
int err = _PyObject_LookupSpecialMethod(name, method_and_self);
3430-
if (err < 0) {
3431-
ERROR_NO_POP();
3432-
}
3433-
else if (err == 0) {
3434-
_PyErr_Format(tstate, PyExc_TypeError,
3435-
_Py_SpecialMethods[oparg].error,
3436-
PyStackRef_TYPE(method_and_self[1])->tp_name);
3430+
if (err <= 0) {
3431+
if (err == 0) {
3432+
_PyErr_Format(tstate, PyExc_TypeError,
3433+
_Py_SpecialMethods[oparg].error,
3434+
PyStackRef_TYPE(method_and_self[1])->tp_name);
3435+
}
34373436
ERROR_NO_POP();
34383437
}
34393438
}

Python/executor_cases.c.h

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)