summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-07-10 15:47:08 (GMT)
committerGuido van Rossum <guido@python.org>1998-07-10 15:47:08 (GMT)
commitba0d0611e7916265a1be2a57cdf3921cc42c5e5d (patch)
tree96487537a5f1b5ae316f8d2d00852edb30e8786c
parentd4ba73c75bd4a0f049d8fb45859ddee1a2393b4f (diff)
downloadcpython-ba0d0611e7916265a1be2a57cdf3921cc42c5e5d.zip
cpython-ba0d0611e7916265a1be2a57cdf3921cc42c5e5d.tar.gz
cpython-ba0d0611e7916265a1be2a57cdf3921cc42c5e5d.tar.bz2
Add macros for direct access to the members of CFunction objects.
-rw-r--r--Include/funcobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/funcobject.h b/Include/funcobject.h
index 3c3618e..a8834a7 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -56,6 +56,15 @@ extern PyObject *PyFunction_GetGlobals Py_PROTO((PyObject *));
extern PyObject *PyFunction_GetDefaults Py_PROTO((PyObject *));
extern int PyFunction_SetDefaults Py_PROTO((PyObject *, PyObject *));
+/* Macros for direct access to these values. Type checks are *not*
+ done, so use with care. */
+#define PyFunction_GET_CODE(func) \
+ (((PyFunctionObject *)func) -> func_code)
+#define PyFunction_GET_GLOBALS(func) \
+ (((PyFunctionObject *)func) -> func_globals)
+#define PyFunction_GET_DEFAULTS(func) \
+ (((PyFunctionObject *)func) -> func_defaults)
+
#ifdef __cplusplus
}
#endif