Skip to content

Commit

Permalink
handle create pattern when expr is not an Expression/Atom
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed Nov 16, 2022
1 parent c8cbe50 commit 21edeea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mathics/core/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def create(expr: BaseElement) -> "Pattern":
Otherwise, if ``expr`` is an ``Atom``, create and return ``AtomPattern`` for ``expr``.
Otherwise, create and return and ``ExpressionPattern`` for ``expr``.
"""
if not isinstance(expr, (Atom, Expression)):
expr = expr.to_expression()

name = expr.get_head_name()
pattern_object = pattern_objects.get(name)
Expand Down

0 comments on commit 21edeea

Please sign in to comment.