> 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? I have yet to find the time to read PEP 266, but I expect so -- this is how I solve many such concerns in 2.2 already (e.g. an extension type is only subclassable if it has the Py_TPFLAGS_BASETYPE flag, which is not included in Py_TPFLAGS_DEFAULT). --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4