From: Guido van Rossum Date: Wed, 9 Nov 2016 21:23:04 +0000 (-0800) Subject: Issue #28649: typing-clear-caches.patch X-Git-Tag: v3.6.0b4~110^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b107560191085a0c5462ad878e1e9eeae94ba82;p=thirdparty%2FPython%2Fcpython.git Issue #28649: typing-clear-caches.patch --- diff --git a/Lib/typing.py b/Lib/typing.py index e748fd9cdfae..f3e446e61bda 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: