[New-bugs-announce] [issue28427] WeakValueDictionary next bug (with multithreading)

Armin Rigo report at bugs.python.org
Thu Oct 13 06:36:29 EDT 2016


New submission from Armin Rigo:

Follow-up on http://bugs.python.org/issue19542.

Another crash of using WeakValueDictionary() in a thread-local fashion inside a multi-threaded program.  I must admit I'm not exactly sure why this occurs, but it is definitely showing an issue: two threads independently create their own WeakValueDictionary() and try to set one item in it.  The problem I get is that the "assert 42 in d" sometimes fails, even though 42 was set in that WeakValueDictionary on the previous line and the value is still alive.  This only occurs if there is a cycle of references involving the value.  See attached file.

Reproduced on Python 2.7, 3.3, 3.5, 3.6-debug.

----------
files: test.py
messages: 278555
nosy: arigo
priority: normal
severity: normal
status: open
title: WeakValueDictionary next bug (with multithreading)
type: behavior
versions: Python 2.7, Python 3.3, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file45072/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28427>
_______________________________________


More information about the New-bugs-announce mailing list