Ticket #6622 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

[with patch, positive review] substitution of a dict into a symbolic expression modifies the dict

Reported by: was Owned by: burcin
Priority: major Milestone: sage-4.1.1
Component: calculus Keywords:
Cc: Work issues:
Report Upstream: Reviewers: Burcin Erocal
Authors: Bill Cauchois Merged in: Sage 4.1.1.rc1
Dependencies: Stopgaps:

Description (last modified by mvngu) (diff)

sage: var('v t')
sage: f = v*t
sage: D = {v: 2}
sage: f(D, t=3)
6
sage: D
{v: 2, t: 3}

After the call above, D should *not* be changed. This issue was raised at this  sage-support thread.

Attachments

trac_6622.patch Download (1.3 KB) - added by wcauchois 4 years ago.
based on sage 4.1.1.alpha1

Change History

comment:1 Changed 4 years ago by was

Here's how to workaround it (namely, put "dict(constants)" instead of "constants"). In the code for call or subs, something similar should be done.

sage: var('v t')
sage: f = v*t
sage: s = {v: 2}
sage: f(dict(s), t=3)
6
sage: s
{v: 2}

comment:2 Changed 4 years ago by mvngu

  • Description modified (diff)

Changed 4 years ago by wcauchois

based on sage 4.1.1.alpha1

comment:3 Changed 4 years ago by wcauchois

  • Summary changed from substitution of a dict into a symbolic expression modifies the dict to [with patch, needs review] substitution of a dict into a symbolic expression modifies the dict

This was a simple fix.

comment:4 Changed 4 years ago by burcin

  • Reviewers set to Burcin Erocal
  • Summary changed from [with patch, needs review] substitution of a dict into a symbolic expression modifies the dict to [with patch, positive review] substitution of a dict into a symbolic expression modifies the dict
  • Authors set to Bill Cauchois

comment:5 Changed 4 years ago by mvngu

  • Status changed from new to closed
  • Resolution set to fixed
  • Merged in set to Sage 4.1.1.rc1
Note: See TracTickets for help on using tickets.