SymbolicRing can wrap pretty arbitrary Python objects as SR elements. Lots of things can obviously go wrong with that, but allowing expressions to be effectively mutable is going too far.
sage: m = matrix(QQ, 2, 2)
sage: M = SR(m)
sage: type(M)
<class 'sage.symbolic.expression.Expression'>
sage: m[0,1] = 8
sage: M
[0 8]
[0 0]
SymbolicRing
can wrap pretty arbitrary Python objects as SR elements. Lots of things can obviously go wrong with that, but allowing expressions to be effectively mutable is going too far.We should make an immutable copy before wrapping.
Depends on #32391
CC: @tscrim @mjungmath @nbruin @kwankyu @orlitzky
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/32450