[Python-Dev] are CObjects inherently unsafe?

Michael Hudson mwh at python.net
Fri Dec 5 06:06:53 EST 2003


Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> Michael Hudson <mwh at python.net>:
>
>> It seems to me that any time there are more than two CObjects around we 
>> have a good chance of causing mischief:
>
> 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.

> And I suspect that many modules which make use of CObjects
> aren't that careful. CStringIO obviously isn't...

As things stand, I don't think cPickle *can* be careful enough.
Perhaps we could just add a "name" field to CObjects and have module
init functions check that.

Cheers,
mwh

-- 
 (Of course SML does have its weaknesses, but by comparison, a
  discussion of C++'s strengths and flaws always sounds like an
  argument about whether one should face north or east when one
  is sacrificing one's goat to the rain god.)         -- Thant Tessman



More information about the Python-Dev mailing list