From a4b0204032a294b4f30f9be270e653376f4e1dbb Mon Sep 17 00:00:00 2001 From: "bar.harel" Date: Wed, 31 May 2023 22:56:34 +0100 Subject: [PATCH 1/2] fix docstring --- Lib/functools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py index 72b2103e7a5544..4d5e2709007843 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -483,8 +483,9 @@ def lru_cache(maxsize=128, typed=False): can grow without bound. If *typed* is True, arguments of different types will be cached separately. - For example, f(3.0) and f(3) will be treated as distinct calls with - distinct results. + For example, f(decimal.Decimal("3.0")) and f(3.0) will be treated as + distinct calls with distinct results. Some types such as str and int may + be cached separately even when typed is false. Arguments to the cached function must be hashable. From 5979efcedb8a0198811c66b005de869338872b4c Mon Sep 17 00:00:00 2001 From: "bar.harel" Date: Wed, 31 May 2023 23:06:07 +0100 Subject: [PATCH 2/2] news --- .../2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst diff --git a/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst b/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst new file mode 100644 index 00000000000000..96cf7220e53079 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst @@ -0,0 +1,2 @@ +Fixed :func:`functools.lru_cache` docstring accounting for ``typed`` +argument's different handling of str and int. Patch by Bar Harel.