mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
merge heads
This commit is contained in:
commit
29a837d857
1 changed files with 1 additions and 2 deletions
|
@ -156,6 +156,7 @@ def lru_cache(maxsize=100, typed=False):
|
||||||
lock = Lock() # needed because linkedlist isn't threadsafe
|
lock = Lock() # needed because linkedlist isn't threadsafe
|
||||||
root = [] # root of circular doubly linked list
|
root = [] # root of circular doubly linked list
|
||||||
root[:] = [root, root, None, None] # initialize by pointing to self
|
root[:] = [root, root, None, None] # initialize by pointing to self
|
||||||
|
PREV, NEXT, KEY, RESULT = 0, 1, 2, 3 # names of link fields
|
||||||
|
|
||||||
if maxsize is None:
|
if maxsize is None:
|
||||||
@wraps(user_function)
|
@wraps(user_function)
|
||||||
|
@ -191,8 +192,6 @@ def lru_cache(maxsize=100, typed=False):
|
||||||
key += tuple(map(type, args))
|
key += tuple(map(type, args))
|
||||||
if kwds:
|
if kwds:
|
||||||
key += tuple(type(v) for k, v in sorted_items)
|
key += tuple(type(v) for k, v in sorted_items)
|
||||||
PREV = 0 # names of link fields
|
|
||||||
NEXT = 1
|
|
||||||
with lock:
|
with lock:
|
||||||
link = cache_get(key)
|
link = cache_get(key)
|
||||||
if link is not None:
|
if link is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue