Just a reply to one part of your message, as I really need to get back
to work for now.
Antoine Pitrou wrote:
I think solution #1 would be the best one.
#2 looks too complicated.
#2 is a seven-line diff, below.
/larry/
Index: cobject.c
===================================================================
--- cobject.c (revision 79396)
+++ cobject.c (working copy)
@@ -50,7 +50,12 @@
PyCObject_AsVoidPtr(PyObject *self)
{
if (self) {
- if (self->ob_type == &PyCObject_Type)
+ if (PyCapsule_CheckExact(self)) {
+ const char *name = PyCapsule_GetName(self);
+ const void *value = PyCapsule_GetPointer(self, name);
+ return value;
+ }
+ else if (self->ob_type == &PyCObject_Type)
return ((PyCObject *)self)->cobject;
PyErr_SetString(PyExc_TypeError,
"PyCObject_AsVoidPtr with non-C-object");
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com