Opened 3 months ago

Last modified 3 months ago

#32450 new enhancement

SymbolicRing._force_pyobject: Make immutable copies of mutable objects

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-9.5
Component: symbolics Keywords:
Cc: tscrim, gh-mjungmath, nbruin, klee, mjo Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #32391 Stopgaps:

Status badges


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]

We should make an immutable copy before wrapping.

Change History (1)

comment:1 Changed 3 months ago by mkoeppe

  • Dependencies set to #32391
Note: See TracTickets for help on using tickets.