diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-08-02 04:15:00 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-08-02 04:15:00 (GMT) |
commit | 6d6c1a35e08b95a83dbe47dbd9e6474daff00354 (patch) | |
tree | 542089077b9c2650dcf5c52d6bfcef1baf12d176 /Objects/abstract.c | |
parent | 52d55a392600011d3edfe85c694744ec550ad1fe (diff) | |
download | cpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.zip cpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.tar.gz cpython-6d6c1a35e08b95a83dbe47dbd9e6474daff00354.tar.bz2 |
Merge of descr-branch back into trunk.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 20 |
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) { |