In python3.5, a race-condition in both .items() and .values() can be
triggered. Here's an example script:
import expiringdict
import time
d = expiringdict.ExpiringDict(10, 1)
d[1] = 1
time.sleep(0.5)
d[2] = 2
time.sleep(0.7)
print(d.items())
Here's what the race-condition looks like:
Traceback (most recent call last):
File "./test.py", line 11, in <module>
print(d.items())
File "/home/kormat/expiringdict/__init__.py", line 115, in items
for key in self:
RuntimeError: OrderedDict mutated during iteration
The fix is very simple - make a list of the keys before iterating.
In python3.5, a race-condition in both .items() and .values() can be triggered. Here's an example script:
Here's what the race-condition looks like:
The fix is very simple - make a list of the keys before iterating.
This change is