core[patch]: add caching to get_function_nonlocals (#28131)

This commit is contained in:
Vadym Barda
2024-11-15 10:53:53 -05:00
committed by GitHub
parent 74438f3ae8
commit ed4952e475

View File

@@ -388,6 +388,7 @@ def get_lambda_source(func: Callable) -> Optional[str]:
return name
@lru_cache(maxsize=256)
def get_function_nonlocals(func: Callable) -> list[Any]:
"""Get the nonlocal variables accessed by a function.