Skip to content

Commit

Permalink
Add macros for direct access to the members of CFunction objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Jul 10, 1998
1 parent d4ba73c commit ba0d061
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Include/funcobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba0d061

Please sign in to comment.