[Greg Ewing] >> Failing that, perhaps they should be made a bit less dynamic, so that >> the GC can make reasonable assumptions about their existence without >> having to execute Python code. [Tim] > Guido already did so for new-style classes in Python 2.3. That machinery > doesn't exist in 2.2.2, and old-style classes remain a problem under 2.3 > too. Backward compatibility constrains how much we can get away with, of > course. FYI, those who study the checkin comments know how this ended. It ended well! gc no longer does anything except string-keyed dict lookups when determining whether a finalizer exists, for old- & new- style classes, and in 2.3 CVS & the 2.2 maintenance branch. The only incompatibilities appear to be genuine bug fixes. The hasattr() method was actually incorrect in two mondo obscure cases (one where hasattr said "yes, __del__ exists" when a finalizer couldn't actually be run, and the other where hasattr said "no, __del__ doesn't exist" when arbitrary Python code actually could be invoked by destructing an object). A new private API function _PyInstance_Lookup was added in 2.2 and 2.3, which does for old-style class instances what _PyType_Lookup does for new-style classes (determines whether an attribute exists via pure C string-keyed dict lookups).
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