On Tuesday, July 2, 2002, at 03:57 , Oren Tirosh wrote: >> Uhm... I'm confused: macimport stores a pointer to the object if it's >> interned (the object in question is one of the strings in sys.path). It >> didn't INCREF the object, and that wasn't needed up until now because >> interned objects can never go away. However, if they can go away I >> would >> think that storing a pointer would definitely call for an INCREF... > > Are you saying that this code is not following reference counting rules > and got away with it only because interned strings are immortal? I'm afraid so. Or, actually, "afraid so" sounds too apologetic:-): interned strings were specifically defined to be immortal. > I don't see how adding only an incref could be correct - there must be a > corresponding decref somewhere. No, there isn't, because this list of pointers is never cleared. Which was never needed, because they were borrowed references. Again, it isn't rocket science to fix this: _PyImport_Fini() will need to call out to a new routine _PyMacImport_Fini() that DECREFs the stored pointers. -- - Jack Jansen <Jack.Jansen@oratrix.com> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman -
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