On Sun, 15 Apr 2001, Tim Peters wrote: > We've got a showstopper bug involving gc and dicts. It's not brand > new, but was probably introduced when we fiddled PyDict_Next() to stop > the dict resizing problems plaguing Jeremy. Crap. Two ideas suggest themselves: (1) don't have the resize check in PyDict_Next (it could be in PyDict_SetItem instead, though the fact that this is safe is delicate to say the least) (2) don't use PyDict_Next in dict_traverse. OTOH, the GC runs __del__ methods, right? So what if a __del__ method mutates the dictionary that .items() is being called on? If allocating memory can execute arbitrary Python code, I dread to think how many bugs of this form are hiding in Python (actually it's only allocating containers that's the worry, but still...). On the third hand, I can't trigger one deliberately, so maybe I'm talking nonsense. To fix items/keys/values, you could build up the list of tuples first, check you still have the right amount, then fill them in. not-sure-this-is-helping-ly y'rs M.
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