[Pyrex] Weakrefs patch

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Dec 7 23:48:25 UTC 2006


Peter Johnson wrote:
> I recently ran into this problem myself (as the current code causes 
> Python to crash), so I whipped up a quick patch that fixes it for me.  I 
> think it follows all of the weakref guidelines now.

Thanks, I'll see about incorporating this into the
main version.

One thing that bothers me a little is that if the
__weakref__ slot can now be NULL, things will blow
up if the user tries to reference it as a normal
attribute, so I might have to put something in to
prevent that. Probably a good idea anyway, since
the user shouldn't be messing with it in the first
place.

Or should they? Are there any legitimate uses for
Pyrex code to access the __weakref__ attribute?

And if not, perhaps it shouldn't have a user visible
name at all? Would some other way of signalling
weak-referenceability be better?

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list