bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)

This commit is contained in:
Jeroen Demeyer 2019-07-11 10:59:05 +02:00 committed by Inada Naoki
parent 2a3d4d9c53
commit 59ad110d7a
23 changed files with 104 additions and 93 deletions

View file

@ -480,7 +480,6 @@ _abc__abc_instancecheck_impl(PyObject *module, PyObject *self,
/*[clinic end generated code: output=b8b5148f63b6b56f input=a4f4525679261084]*/
{
PyObject *subtype, *result = NULL, *subclass = NULL;
PyObject *margs[2];
_abc_data *impl = _get_impl(self);
if (impl == NULL) {
return NULL;
@ -515,16 +514,12 @@ _abc__abc_instancecheck_impl(PyObject *module, PyObject *self,
}
}
/* Fall back to the subclass check. */
margs[0] = self;
margs[1] = subclass;
result = _PyObject_VectorcallMethodId(&PyId___subclasscheck__, margs,
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
result = _PyObject_CallMethodIdOneArg(self, &PyId___subclasscheck__,
subclass);
goto end;
}
margs[0] = self;
margs[1] = subclass;
result = _PyObject_VectorcallMethodId(&PyId___subclasscheck__, margs,
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
result = _PyObject_CallMethodIdOneArg(self, &PyId___subclasscheck__,
subclass);
if (result == NULL) {
goto end;
}
@ -536,10 +531,8 @@ _abc__abc_instancecheck_impl(PyObject *module, PyObject *self,
break;
case 0:
Py_DECREF(result);
margs[0] = self;
margs[1] = subtype;
result = _PyObject_VectorcallMethodId(&PyId___subclasscheck__, margs,
2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
result = _PyObject_CallMethodIdOneArg(self, &PyId___subclasscheck__,
subtype);
break;
case 1: // Nothing to do.
break;
@ -620,8 +613,8 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
}
/* 3. Check the subclass hook. */
ok = _PyObject_CallMethodIdObjArgs((PyObject *)self, &PyId___subclasshook__,
subclass, NULL);
ok = _PyObject_CallMethodIdOneArg((PyObject *)self, &PyId___subclasshook__,
subclass);
if (ok == NULL) {
goto end;
}