Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 411fd55

Browse filesBrowse files
committed
added a comment clarifying the indirection
1 parent 2fed985 commit 411fd55
Copy full SHA for 411fd55

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎Lib/typing.py

Copy file name to clipboardExpand all lines: Lib/typing.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ def _tp_cache(func=None, /, *, typed=False):
352352
original function for non-hashable arguments.
353353
"""
354354
def decorator(func):
355+
# The callback 'inner' references the newly created lru_cache
356+
# indirectly by performing a lookup in the global '_caches' dictionary.
357+
# This breaks a reference that can be problematic when combined with
358+
# C API extensions that leak references to types. See GH-98253.
359+
355360
cache = functools.lru_cache(typed=typed)(func)
356361
_caches[func] = cache
357362
_cleanups.append(cache.cache_clear)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.