Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 7f9666a

Browse files
Fixed recursion when non-match at toplevel.
1 parent c3bcef0 commit 7f9666a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/sage/symbolic/expression.pyx

+9-5
Original file line numberDiff line numberDiff line change
@@ -10442,8 +10442,9 @@ cdef class Expression(CommutativeRingElement):
1044210442
return(apply(op, l))
1044310443
if self.parent() is not sage.all.SR: return self
1044410444
op = self.operator()
10445+
if op is None : return self
1044510446
if op in {opsum, opdi, opii}:
10446-
sa = self.operands()[0]
10447+
sa = self.operands()[0].expand()
1044710448
op1 = sa.operator()
1044810449
if op1 is opadd:
1044910450
la = self.operands()[1:]
@@ -10453,10 +10454,13 @@ cdef class Expression(CommutativeRingElement):
1045310454
t.distribute(),
1045410455
la),
1045510456
aa))
10456-
else: return sum(map(lambda t:treat_term(op, t, la), aa))
10457-
else: return self
10458-
else: return self
10459-
10457+
return sum(map(lambda t:treat_term(op, t, la), aa))
10458+
return self
10459+
if recursive:
10460+
return apply(op, map(lambda t:t.distribute(), self.operands()))
10461+
return self
10462+
10463+
1046010464
def factor(self, dontfactor=[]):
1046110465
"""
1046210466
Factor the expression, containing any number of variables or functions, into

0 commit comments

Comments
 (0)