Kristján Valur Jónsson wrote:
What are the semantics of the "type" argument for PyCObject_FromVoidPtr()?
From the patch, from the documentation comment above the prototype for PyCObject_FromVoidPtr() in Include/cobject.h:
The "type" string must point to a legal C string of non-zero length,
-Does it do a strdup, or is the type required to be valid while the object exists (e.g. a static string)?
From the patch, continuing on from where we just left off: and this string must outlive the CObject.
-How is the type match determined, strcmp, or pointer comparison?
From the patch, observing the code in the static function _is_legal_cobject_and_type() in Objects/cobject.c:
if (!type || !*type) { PyErr_SetString(PyExc_TypeError, invalidType); return 0; } if (strcmp(type, self->type)) { PyErr_SetString(PyExc_TypeError, incorrectType); return 0; } A method for answering further such questions suggests itself, /larry// / _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com