]> granicus.if.org Git - python/commitdiff
Issue #28649: typing-clear-caches.patch
authorGuido van Rossum <guido@python.org>
Wed, 9 Nov 2016 21:23:04 +0000 (13:23 -0800)
committerGuido van Rossum <guido@python.org>
Wed, 9 Nov 2016 21:23:04 +0000 (13:23 -0800)
Lib/typing.py

index e748fd9cdfae019bec35cc8f2df9bdeb46d72e6e..f3e446e61bdacc3babfad9b53a7cb15b704ae35e 100644 (file)
@@ -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: