Larry Hastings added the comment: Patch attached. The basics were okay; however, there was no locking around access to a static variable (_Py_AllocatedBlocks) so I added some. The way the code managed _Py_AllocatedBlocks was a bit odd; this approach resulted in fewer lines, but it was hard to follow, and adding locking support would have muddied it even further, so I simplified it. I also simplified the locking support a great deal ("SIMPLELOCK": YAGNI) and touched up the relevant comment.
Finally, I noticed a minor bug wrt added _Py_AllocatedBlocks: if you call PyMem_Realloc(NULL, 50000), that's really a new allocation, so _Py_AllocatedBlocks needs to be incremented, but it wasn't. Since Antoine is the father of _Py_AllocatedBlocks I added him to the nosy list. ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26753> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com