Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(27)

#28969: lru_cache is not threadsafe

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 years, 5 months ago by nicolas.savoire
Modified:
3 years, 5 months ago
Reviewers:
shadowranger+python, storchaka+cpython, pitrou
CC:
rhettinger, jcea, __peter___web.de, haypo, ned.deily, inada.naoki, storchaka, Josh.R, Nicolas Savoire
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 6

Patch Set 3 #

Patch Set 4 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_functools.py View 1 2 3 2 chunks +15 lines, -0 lines 0 comments Download
Modules/_functoolsmodule.c View 1 2 3 2 chunks +38 lines, -21 lines 0 comments Download
Objects/dictobject.c View 1 2 3 3 chunks +23 lines, -8 lines 0 comments Download

Messages

Total messages: 4
Josh.R
I don't think you can completely close this race condition without locks, not so long ...
3 years, 5 months ago #1
storchaka
https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c File Modules/_functoolsmodule.c (right): https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c#newcode902 Modules/_functoolsmodule.c:902: still adjusting the links. */ On 2016/12/16 01:54:33, josh.rosenberg ...
3 years, 5 months ago #2
pitrou_free.fr
https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c File Modules/_functoolsmodule.c (right): https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c#newcode833 Modules/_functoolsmodule.c:833: _PyDict_Pop_KnownHash(PyDictObject *, PyObject *, Py_hash_t, PyObject *); This should ...
3 years, 5 months ago #3
storchaka
3 years, 5 months ago #4
https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c
File Modules/_functoolsmodule.c (right):

https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c#ne...
Modules/_functoolsmodule.c:833: _PyDict_Pop_KnownHash(PyDictObject *, PyObject
*, Py_hash_t, PyObject *);
On 2016/12/28 10:55:17, AntoinePitrou wrote:
> This should go in dictobject.h instead.

Agreed. I placed it here temporary for the time of developing. Just to avoid the
full rebuild after applying or reverting the patch.

I'll move it in the header just before committing.

https://bugs.python.org/review/28969/diff/19478/Modules/_functoolsmodule.c#ne...
Modules/_functoolsmodule.c:878: popresult = _PyDict_Pop_KnownHash((PyDictObject
*)self->cache,
On 2016/12/28 10:55:17, AntoinePitrou wrote:
> You could use None for the sentinel.

Good point! Cache's values are link objects, thay can't be None.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+