From 01248786268c80eede2d5737415b582a4d955442 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Fri, 7 Nov 2025 14:04:49 -0500 Subject: [PATCH] Make SympyExpression iterable HypergeometricPFQ takes a list as an argument. When to_sympy is called on HypergeometricPFQ it turns the list into a SympyExpresssion and passes it into sympy.hyper, which expects the argument passed in to be iterable. This change makes that the case. --- mathics/core/convert/sympy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mathics/core/convert/sympy.py b/mathics/core/convert/sympy.py index df091e1c3..5794e912b 100644 --- a/mathics/core/convert/sympy.py +++ b/mathics/core/convert/sympy.py @@ -4,7 +4,7 @@ Converts expressions from SymPy to Mathics expressions. Conversion to SymPy is handled directly in BaseElement descendants. """ -from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union, cast +from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Sequence, Tuple, Union, cast import sympy from sympy import Symbol as Sympy_Symbol, false as SympyFalse, true as SympyTrue @@ -207,6 +207,9 @@ def is_commutative(self, value: bool) -> None: def __str__(self) -> str: return f"{super().__str__()}[{self.expr}])" + def __iter__(self) -> Iterator: + return iter(self.args) + class SympyPrime(sympy.Function): """