From fcceab4c0c59bdbcf79ebca844ac3865bb6e795d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 30 May 2024 17:04:50 +0200 Subject: [PATCH] Fix necompiler.getArguments() on Python 3.13.0b1 The FrameLocalsProxy object (PEP 667) cannot be cleared. Fixes https://github.com/pydata/numexpr/issues/488 --- numexpr/necompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numexpr/necompiler.py b/numexpr/necompiler.py index 5126bd7..1e60b5a 100644 --- a/numexpr/necompiler.py +++ b/numexpr/necompiler.py @@ -767,7 +767,7 @@ def getArguments(names, local_dict=None, global_dict=None, _frame_depth: int=2): # If we generated local_dict via an explicit reference to f_locals, # clear the dict to prevent creating extra ref counts in the caller's scope # See https://github.com/pydata/numexpr/issues/310 - if clear_local_dict: + if clear_local_dict and hasattr(local_dict, 'clear'): local_dict.clear() return arguments -- 2.45.0