Peter Otten added the comment:
Here's another way to reproduce the error. The problem seems to be in the C
implementation of _lru_cache_wrapper() / bounded_lru_cache_wrapper().
$ cat test.py
import functools
import threading
import time
@functools.lru_cache(maxsize=2)
def f(v):
time.sleep(.01)
threads = [threading.Thread(target=f, args=(v,)) for v in [1,2,2,3,2]]
for t in threads:
t.start()
$ ./python test.py
Exception in thread Thread-5:
Traceback (most recent call last):
File "/somewhere/Lib/threading.py", line 916, in _bootstrap_inner
self.run()
File "/somewhere/Lib/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
KeyError: (2,)
$ ./python
Python 3.7.0a0 (default:654ec6ed3225+, Dec 15 2016, 11:24:30)
[GCC 4.8.4] on linux
----------
nosy: +peter.otten, rhettinger, serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28969>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com