[Python-Dev] are CObjects inherently unsafe? (original) (raw)

Michael Hudson mwh at python.net
Fri Dec 5 10:12:45 EST 2003


Guido van Rossum <guido at python.org> writes:

> Indeed, CObjects seem fundamentally dangerous to me, unless > the modules which create and use them are extremely careful > to make sure they can tell whether they've got the right > kind of CObject.

Well, the right CObject -- it's CObject identity that matters. I seem to recall that the CObject design contains a feature to avoid using the wrong CObject, but it's not used by any of the CObject implementations in the standard library, and the CObject docs don't describe how it's meant to use (they were clearly reverse-engineered from the code). [...] 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).

It had occurred to me that you could use this field for this purpose, but it hadn't occurred to me that this might have been the intent of this field.

Why a void* then? That's particularly unassertive. char* would be better, surely...

Cheers, mwh

-- I also fondly recall Paris because that's where I learned to debug Zetalisp while drunk. -- Olin Shivers



More information about the Python-Dev mailing list