[Python-Dev] PEP 266: Catching code that is not safe for tracking
firstname.lastname@example.org (Skip Montanaro)
Thu, 16 Aug 2001 02:05:54 -0500
>> 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?
Guido> I have yet to find the time to read PEP 266, but I expect so -- this
Guido> is how I solve many such concerns in 2.2 already (e.g. an extension
Guido> type is only subclassable if it has the Py_TPFLAGS_BASETYPE flag,
Guido> which is not included in Py_TPFLAGS_DEFAULT).
Looks I should just add another flag to | into the tp_flags slot instead of
allocating another int-sized slot.
I hope to have some code for people to look at in the next few days.