[Python-Dev] PEP 266: Catching code that is not safe for tracking

Skip Montanaro skip@pobox.com (Skip Montanaro)
Wed, 15 Aug 2001 19:16:28 -0500


While I was out for my semi-occasion-once-every-other-wednesday run this
afternoon, I thought about the problem of identifying objects that are not
safe for the tracking proposal in PEP 266.  My worry is that an extension
module that works in Python 2.2 will break in subtle ways in Python 2.3 if
my tracking idea is enabled, because the module's code is not doing anything
to notify the rest of the world when an attribute binding changes.

I came up with the following possible solution.  Add a new slot to type
objects that the object's author must explicitly set to Py_TRACKING_SAFE
(1?).  It would default to Py_TRACKING_UNSAFE (0?).  This value could be
checked by _PyObject_TrackName and a warning raised if a program tries to
track an unsafe object.

Would that work?

Skip