Mercurial > cpython-lru_cache-weakref
diff Modules/_ctypes/ctypes.h @ 46546:4ff8dfaec3fc legacy-trunk
Remove cyclic reference in CFuncPtr instances; see issue #2682.
Backport candidate for the release25-maint branch.
| author | Thomas Heller <theller@ctypes.org> |
|---|---|
| date | Thu, 24 Apr 2008 18:14:19 +0000 |
| parents | b3dca8f5535e |
| children | 8ad4ebdbd373 |
line wrap: on
line diff
--- a/Modules/_ctypes/ctypes.h Thu Apr 24 18:07:05 2008 +0000 +++ b/Modules/_ctypes/ctypes.h Thu Apr 24 18:14:19 2008 +0000 @@ -84,14 +84,18 @@ }; typedef struct { + PyObject_VAR_HEAD ffi_closure *pcl; /* the C callable */ ffi_cif cif; PyObject *converters; PyObject *callable; + PyObject *restype; SETFUNC setfunc; - ffi_type *restype; + ffi_type *ffi_restype; ffi_type *atypes[1]; -} ffi_info; +} CThunkObject; +extern PyTypeObject CThunk_Type; +#define CThunk_CheckExact(v) ((v)->ob_type == &CThunk_Type) typedef struct { /* First part identical to tagCDataObject */ @@ -107,7 +111,7 @@ union value b_value; /* end of tagCDataObject, additional fields follow */ - ffi_info *thunk; + CThunkObject *thunk; PyObject *callable; /* These two fields will override the ones in the type's stgdict if @@ -178,10 +182,10 @@ extern PyMethodDef module_methods[]; -extern ffi_info *AllocFunctionCallback(PyObject *callable, - PyObject *converters, - PyObject *restype, - int stdcall); +extern CThunkObject *AllocFunctionCallback(PyObject *callable, + PyObject *converters, + PyObject *restype, + int stdcall); /* a table entry describing a predefined ctypes type */ struct fielddesc { char code;
