]> granicus.if.org Git - python/commitdiff
Add macros for direct access to the members of CFunction objects.
authorGuido van Rossum <guido@python.org>
Fri, 10 Jul 1998 15:47:08 +0000 (15:47 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 10 Jul 1998 15:47:08 +0000 (15:47 +0000)
Include/funcobject.h

index 3c3618efdc66cfd5b68ba2353af338a6de3c016f..a8834a7e3f39109418b047a3c79c3c621525a466 100644 (file)
@@ -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