gh-112070: make functools.lru_cache threadsafe in --disable-gil build (gh-112111)

* gh-112070: make `functools.lrucacle` threadsafe in --disable-gil build

* gh-112070: update generate `functoolsmodule` files

* gh-112070: add NEWS file

* Delete Misc/NEWS.d/next/Library/2023-11-15-20-19-45.gh-issue-112070.q6OhcU.rst

* gh-112070: reformat functoolsmodule.c

---------

Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
Wanderxjtu 2023-11-17 13:03:02 +08:00 committed by GitHub
parent 8cd70eefc7
commit 0ee2d77331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 6 deletions

View file

@ -81,7 +81,13 @@ _functools__lru_cache_wrapper_cache_info_impl(PyObject *self);
static PyObject *
_functools__lru_cache_wrapper_cache_info(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _functools__lru_cache_wrapper_cache_info_impl(self);
PyObject *return_value = NULL;
Py_BEGIN_CRITICAL_SECTION(self);
return_value = _functools__lru_cache_wrapper_cache_info_impl(self);
Py_END_CRITICAL_SECTION();
return return_value;
}
PyDoc_STRVAR(_functools__lru_cache_wrapper_cache_clear__doc__,
@ -99,6 +105,12 @@ _functools__lru_cache_wrapper_cache_clear_impl(PyObject *self);
static PyObject *
_functools__lru_cache_wrapper_cache_clear(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _functools__lru_cache_wrapper_cache_clear_impl(self);
PyObject *return_value = NULL;
Py_BEGIN_CRITICAL_SECTION(self);
return_value = _functools__lru_cache_wrapper_cache_clear_impl(self);
Py_END_CRITICAL_SECTION();
return return_value;
}
/*[clinic end generated code: output=231403340a20e31b input=a9049054013a1b77]*/
/*[clinic end generated code: output=5e3207fa0d28cdb1 input=a9049054013a1b77]*/