Daniel Romberg <dan...@romberg.io> added the comment:

I think this issue needs to be reopened. The problem has not been solved 
completely. We experience a lot fewer crashes in weakref than before this fix, 
however, there are recursive situations in which copy() is invoked while 
iterating the WeakValueDictionary (e.g., in our case it is a signal/slot 
implementation where the slots are stored in a WeakValueDictionary). 
_commit_removals(), which is called at the beginning of the copy operation, 
might change the dictionary if there are items that are to be removed. If there 
is an ongoing iteration, the corresponding RuntimeError is raised.

I haven't thought that through entirely, but I wonder whether the copy (and 
also deepcopy) operation could just blindly copy everything without "committing 
removals". After the copy, both instances would do their _commit_removals on 
their own upon access.

----------
nosy: +djromberg

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

Reply via email to