Skip to content

Commit

Permalink
Fix optional patterns without default values: Newpattern only if not …
Browse files Browse the repository at this point in the history
…set.
  • Loading branch information
aravindh-krishnamoorthy committed Nov 19, 2024
1 parent c1999ce commit e1dee54
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mathics/core/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,10 @@ def match_expression_with_one_identity(
result = defaultvalue_expr.evaluate(evaluation)
assert result is not None
if result.sameQ(defaultvalue_expr):
# The optional pattern has no default value
# for the given position
new_pattern = pat_elem
if new_pattern is None:
# The optional pattern has no default value
# for the given position
new_pattern = pat_elem
else:
optionals[key] = result
else:
Expand Down

0 comments on commit e1dee54

Please sign in to comment.