Serhiy Storchaka added the comment:

There is a problem with odict-trashcan.v3.patch. PyDict_Type.tp_dealloc() can 
put the object to the freelist if it's type is dict. Since odict_dealloc() 
fakes object's type, it alows deallocated OrderedDict to be later used as dict. 
But the size of OrderedDict object is larger than the size of plain dict, this 
creates a leak.

odict-trashcan.v2.patch is not good too. I found new test that crashes with it.

Here is a patch that solves all known issues with OrderedDict deallocation. 
Please correct my wording in the comment if needed. Similar bad scenario is 
described in the comment at the end of subtype_dealloc() in 
Objects/typeobject.c, but the patch uses different method to solve this.

----------
stage: commit review -> patch review
Added file: http://bugs.python.org/file40822/odict-trashcan.v4.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to