summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 63fe7d5..a0f075f 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1589,6 +1589,24 @@ PyObject_CallObject(PyObject *o, PyObject *a)
}
PyObject *
+PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw)
+{
+ ternaryfunc call;
+
+ if ((call = func->ob_type->tp_call) != NULL) {
+ PyObject *result = (*call)(func, arg, kw);
+ if (result == NULL && !PyErr_Occurred())
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ return result;
+ }
+ PyErr_Format(PyExc_TypeError, "object is not callable: %s",
+ PyString_AS_STRING(PyObject_Repr(func)));
+ return NULL;
+}
+
+PyObject *
PyObject_CallFunction(PyObject *callable, char *format, ...)
{
va_list va;
@@ -1746,7 +1764,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
}
}
else if (PyType_Check(cls)) {
- retval = ((PyObject *)(inst->ob_type) == cls);
+ retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls);
}
else if (!PyInstance_Check(inst)) {
if (__class__ == NULL) {