summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index a0edf17..228d821 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1922,9 +1922,10 @@ dummy_func(
DECREF_INPUTS();
ERROR_IF(super == NULL, error);
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
- attr = PyStackRef_FromPyObjectSteal(PyObject_GetAttr(super, name));
+ PyObject *attr_o = PyObject_GetAttr(super, name);
Py_DECREF(super);
- ERROR_IF(PyStackRef_IsNull(attr), error);
+ ERROR_IF(attr_o == NULL, error);
+ attr = PyStackRef_FromPyObjectSteal(attr_o);
null = PyStackRef_NULL;
}
@@ -2740,9 +2741,10 @@ dummy_func(
inst(GET_ITER, (iterable -- iter)) {
/* before: [obj]; after [getiter(obj)] */
- iter = PyStackRef_FromPyObjectSteal(PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable)));
+ PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable));
DECREF_INPUTS();
- ERROR_IF(PyStackRef_IsNull(iter), error);
+ ERROR_IF(iter_o == NULL, error);
+ iter = PyStackRef_FromPyObjectSteal(iter_o);
}
inst(GET_YIELD_FROM_ITER, (iterable -- iter)) {
@@ -3052,16 +3054,18 @@ dummy_func(
PyObject *owner_o = PyStackRef_AsPyObjectSteal(owner);
PyObject *name = _Py_SpecialMethods[oparg].name;
PyObject *self_or_null_o;
- attr = PyStackRef_FromPyObjectSteal(_PyObject_LookupSpecialMethod(owner_o, name, &self_or_null_o));
- if (PyStackRef_IsNull(attr)) {
+ PyObject *attr_o = _PyObject_LookupSpecialMethod(owner_o, name, &self_or_null_o);
+ if (attr_o == NULL) {
if (!_PyErr_Occurred(tstate)) {
_PyErr_Format(tstate, PyExc_TypeError,
_Py_SpecialMethods[oparg].error,
Py_TYPE(owner_o)->tp_name);
}
+ ERROR_IF(true, error);
}
- ERROR_IF(PyStackRef_IsNull(attr), error);
- self_or_null = PyStackRef_FromPyObjectSteal(self_or_null_o);
+ attr = PyStackRef_FromPyObjectSteal(attr_o);
+ self_or_null = self_or_null_o == NULL ?
+ PyStackRef_NULL : PyStackRef_FromPyObjectSteal(self_or_null_o);
}
inst(WITH_EXCEPT_START, (exit_func, exit_self, lasti, unused, val -- exit_func, exit_self, lasti, unused, val, res)) {
@@ -3092,9 +3096,10 @@ dummy_func(
(void)lasti; // Shut up compiler warning if asserts are off
PyObject *stack[5] = {NULL, PyStackRef_AsPyObjectBorrow(exit_self), exc, val_o, tb};
int has_self = !PyStackRef_IsNull(exit_self);
- res = PyStackRef_FromPyObjectSteal(PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
- (3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL));
- ERROR_IF(PyStackRef_IsNull(res), error);
+ PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
+ (3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
+ ERROR_IF(res_o == NULL, error);
+ res = PyStackRef_FromPyObjectSteal(res_o);
}
pseudo(SETUP_FINALLY, (-- unused), (HAS_ARG)) = {
@@ -4539,9 +4544,10 @@ dummy_func(
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value_o)) {
- res = PyStackRef_FromPyObjectSteal(PyObject_Format(value_o, NULL));
+ PyObject *res_o = PyObject_Format(value_o, NULL);
PyStackRef_CLOSE(value);
- ERROR_IF(PyStackRef_IsNull(res), error);
+ ERROR_IF(res_o == NULL, error);
+ res = PyStackRef_FromPyObjectSteal(res_o);
}
else {
res = value;