summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-11-09 21:23:04 (GMT)
committerGuido van Rossum <guido@python.org>2016-11-09 21:23:04 (GMT)
commit9b107560191085a0c5462ad878e1e9eeae94ba82 (patch)
tree0cbd98fcc8faae071a8e42cdd2b6119e739c7fbe /Lib/typing.py
parentf9099de8949af434eacb905680849ec3ac41348a (diff)
downloadcpython-9b107560191085a0c5462ad878e1e9eeae94ba82.zip
cpython-9b107560191085a0c5462ad878e1e9eeae94ba82.tar.gz
cpython-9b107560191085a0c5462ad878e1e9eeae94ba82.tar.bz2
Issue #28649: typing-clear-caches.patch
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index e748fd9..f3e446e 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -611,12 +611,16 @@ def _check_generic(cls, parameters):
("many" if alen > elen else "few", repr(cls), alen, elen))
+_cleanups = []
+
+
def _tp_cache(func):
""" Caching for __getitem__ of generic types with a fallback to
original function for non-hashable arguments.
"""
cached = functools.lru_cache()(func)
+ _cleanups.append(cached.cache_clear)
@functools.wraps(func)
def inner(*args, **kwds):
try: