From 85ad0f5ed9055bcc27dedde379809f8e22f9a4b8 Mon Sep 17 00:00:00 2001 From: Aravindh Krishnamoorthy Date: Tue, 19 Nov 2024 14:42:04 +0100 Subject: [PATCH] Fix pattern matching: pop optionals. --- mathics/core/pattern.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mathics/core/pattern.py b/mathics/core/pattern.py index d16847440..3a77b1ea9 100644 --- a/mathics/core/pattern.py +++ b/mathics/core/pattern.py @@ -757,6 +757,8 @@ def match_expression_with_one_identity( del parms["attributes"] assert new_pattern is not None new_pattern.match(expression=expression, pattern_context=parms) + for optional in optionals: + vars_dict.pop(optional) def basic_match_expression(