[Python-Dev] are CObjects inherently unsafe?

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Dec 7 19:37:06 EST 2003


> And the docs should be updated to explain the description better
> (currently at one point the description is called "extra callback data
> for the destructor function" which seems a rather odd feature).

Indeed! That comment completely misled me about the purpose of
the "desc". Ironically, if that sentence simply hadn't been 
there, I probably would have correctly guessed what the desc
was meant for.

Another API suggestion: a function such as

  void* PyCObject_AsVoidPtrWithDesc(PyObject* self, void *expected_desc)

which checks the desc and raises an exception if it doesn't
match the expected value.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list