Antoine Pitrou added the comment:

Hi Armin,

> is it still necessary to modify weakref.py so much, then?

Not sure. I'll take a look again. Modifying __len__() at least is necessary, as 
the previous version took into account the length of _pending_removals (and 
could therefore return wrong results). I'm inclined to be a bit defensive here.

> The C function would simply call PyObject_GetItem() and 
> PyObject_DelItem()---without releasing the GIL in the middle.

If you implement it like that, and the dictionary has non-trivial keys with a 
user-defined __hash__, then the GIL can be released at the beginning of 
PyObject_DelItem().

----------

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

Reply via email to