summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-11 19:56:40 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-11 19:56:40 (GMT)
commita3534a6ff5602ea848b1d27f4f9d9d7913cbe31b (patch)
treea39ae6545f6c82f842768ae2bfa4afcd931f5573 /Include
parentfc5aa9d0bcf56d3bda0f033593ca4506b83515ee (diff)
downloadcpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.zip
cpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.tar.gz
cpython-a3534a6ff5602ea848b1d27f4f9d9d7913cbe31b.tar.bz2
Issue #1587: Added instancemethod wrapper for PyCFunctions. The Python C API
has gained a new type *PyInstanceMethod_Type* and the functions *PyInstanceMethod_Check(o)*, *PyInstanceMethod_New(func)* and *PyInstanceMethod_Function(im)*.
Diffstat (limited to 'Include')
-rw-r--r--Include/classobject.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Include/classobject.h b/Include/classobject.h
index 699546e..f6789d1 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -31,6 +31,24 @@ PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
#define PyMethod_GET_SELF(meth) \
(((PyMethodObject *)meth) -> im_self)
+
+typedef struct {
+ PyObject_HEAD
+ PyObject *func;
+} PyInstanceMethodObject;
+
+PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
+
+#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
+
+PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
+PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
+
+/* Macros for direct access to these values. Type checks are *not*
+ done, so use with care. */
+#define PyInstanceMethod_GET_FUNCTION(meth) \
+ (((PyInstanceMethodObject *)meth) -> func)
+
#ifdef __cplusplus
}
#endif