From: Guido van Rossum Date: Fri, 10 Jul 1998 15:47:08 +0000 (+0000) Subject: Add macros for direct access to the members of CFunction objects. X-Git-Tag: v1.5.2a1~315 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba0d0611e7916265a1be2a57cdf3921cc42c5e5d;p=python Add macros for direct access to the members of CFunction objects. --- diff --git a/Include/funcobject.h b/Include/funcobject.h index 3c3618efdc..a8834a7e3f 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