From 21edeea5ee559e3c9830f6e5d40c2aa892fb4d81 Mon Sep 17 00:00:00 2001 From: mmatera Date: Wed, 16 Nov 2022 11:19:59 -0300 Subject: [PATCH] handle create pattern when expr is not an Expression/Atom --- mathics/core/pattern.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mathics/core/pattern.py b/mathics/core/pattern.py index b0a398d58..334098090 100644 --- a/mathics/core/pattern.py +++ b/mathics/core/pattern.py @@ -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)