diff options
Diffstat (limited to 'Objects/cobject.c')
-rw-r--r-- | Objects/cobject.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Objects/cobject.c b/Objects/cobject.c index eed906a..5a6be43 100644 --- a/Objects/cobject.c +++ b/Objects/cobject.c @@ -99,6 +99,20 @@ PyCObject_Import(char *module_name, char *name) return r; } +int +PyCObject_SetVoidPtr(PyObject *_self, void *cobj) +{ + PyCObject* self = (PyCObject*)_self; + if (self == NULL || !PyCObject_Check(self) || + self->destructor != NULL) { + PyErr_SetString(PyExc_TypeError, + "Invalid call to PyCObject_SetVoidPtr"); + return 0; + } + self->cobject = cobj; + return 1; +} + static void PyCObject_dealloc(PyCObject *self) { |