New submission from Armin Rigo:

Follow-up on

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.

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:

Python tracker <>
Python-bugs-list mailing list

Reply via email to