8000 gh-131757: allow lru_cache functions to execute concurrently by tom-pytel · Pull Request #131758 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131757: allow lru_cache functions to execute concurrently #131758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 14, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unnecessary atomics
  • Loading branch information
tom-pytel committed Mar 26, 2025
commit 68d14eaee615ae8927d4cb82d65ed31535952005
8 changes: 0 additions & 8 deletions Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,11 +1312,7 @@ bounded_lru_cache_get_lock_held(lru_cache_object *self, PyObject *args, PyObject
lru_cache_extract_link(link);
lru_cache_append_link(self, link);
*result = link->result;
#ifdef Py_GIL_DISABLED
_Py_atomic_add_ssize(&self->hits, 1);
#else
self->hits++;
#endif
Py_INCREF(link->result);
Py_DECREF(key_);
return 1;
Expand All @@ -1325,11 +1321,7 @@ bounded_lru_cache_get_lock_held(lru_cache_object *self, PyObject *args, PyObject
Py_DECREF(key_);
return -1;
}
#ifdef Py_GIL_DISABLED
_Py_atomic_add_ssize(&self->misses, 1);
#else
self->misses++;
#endif
return 0;
}

Expand Down
Loading
0