mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Issue #28649: typing-clear-caches.patch (3.5->3.6)
This commit is contained in:
commit
5486a88427
1 changed files with 4 additions and 0 deletions
|
@ -611,12 +611,16 @@ def _check_generic(cls, parameters):
|
||||||
("many" if alen > elen else "few", repr(cls), alen, elen))
|
("many" if alen > elen else "few", repr(cls), alen, elen))
|
||||||
|
|
||||||
|
|
||||||
|
_cleanups = []
|
||||||
|
|
||||||
|
|
||||||
def _tp_cache(func):
|
def _tp_cache(func):
|
||||||
""" Caching for __getitem__ of generic types with a fallback to
|
""" Caching for __getitem__ of generic types with a fallback to
|
||||||
original function for non-hashable arguments.
|
original function for non-hashable arguments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cached = functools.lru_cache()(func)
|
cached = functools.lru_cache()(func)
|
||||||
|
_cleanups.append(cached.cache_clear)
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def inner(*args, **kwds):
|
def inner(*args, **kwds):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue