From 8c3c837c84fb7c5859fe3092ace3ea9f78c86c17 Mon Sep 17 00:00:00 2001 From: Matthew Wardrop Date: Mon, 11 Nov 2024 22:48:11 -0800 Subject: [PATCH] Disable `EvalEnvironment` comparison in Python 3.13+. --- patsy/eval.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/patsy/eval.py b/patsy/eval.py index 12ce0d4..0919787 100644 --- a/patsy/eval.py +++ b/patsy/eval.py @@ -18,6 +18,7 @@ import tokenize import ast import numbers +import pytest from patsy import PatsyError from patsy.util import PushbackAdapter, no_pickling, assert_no_pickling from patsy.tokens import pretty_untokenize, normalize_token_spacing, python_tokenize @@ -423,6 +424,13 @@ def test_EvalEnvironment_subset(): pytest.raises(NameError, subset_bc.eval, "a") +@pytest.mark.skipif( + sys.version_info >= (3, 13), + reason=( + "`frame.f_locals` may return write-through proxies in Python 3.13+, " + "breaking direct comparison by ids." + ), +) def test_EvalEnvironment_eq(): # Two environments are eq only if they refer to exactly the same # global/local dicts