diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-10-19 18:30:01 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-10-19 18:30:01 (GMT) |
commit | 01a74b2fa1b7eef7e4c4f575e353662eeb6e3b49 (patch) | |
tree | 5d3a030a1249c41d7b2f347139737156b341a2a5 /Objects/cobject.c | |
parent | 95cf84a4f3bd6b679e5c632512d02008b5ff8f46 (diff) | |
download | cpython-01a74b2fa1b7eef7e4c4f575e353662eeb6e3b49.zip cpython-01a74b2fa1b7eef7e4c4f575e353662eeb6e3b49.tar.gz cpython-01a74b2fa1b7eef7e4c4f575e353662eeb6e3b49.tar.bz2 |
Make CObjects mutable. Fixes #477441.
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) { |