Opened 4 years ago

Last modified 5 weeks ago

#23304 new defect

hold=True does not always prevent evaluation

Reported by: mmezzarobba Owned by:
Priority: major Milestone: sage-9.5
Component: symbolics Keywords:
Cc: gh-DaveWitteMorris, slelievre Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: #10035 Stopgaps:

Status badges

Description (last modified by rws)

sage: x = SR.var(x)
sage: x + 1/3
x + 1/3
sage: (x + 1/3).power(2, hold=True)
(x + 1/3)^2
sage: (x + 1/3).power(2, hold=True).mul(2, hold=True) # <<< evaluates!
2*(1/9*(3*x + 1)^2)
sage: (x + 1/3).mul(2, hold=True)
2*(x + 1/3)

Reported as https://github.com/pynac/pynac/issues/262

Change History (7)

comment:1 Changed 4 years ago by rws

See also #21754 and #21758.

comment:2 Changed 4 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-8.0 to sage-8.1
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

comment:3 Changed 4 years ago by rws

  • Dependencies set to #10035
  • Milestone changed from sage-8.1 to sage-8.2
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, in a later stable release.

Operations like this are now better done in a hold context. With #10035:

sage: hold.start()
sage: x + 1/3
x + 1/3
sage: (x + 1/3)^2
(x + 1/3)^2
sage: (x + 1/3)^2*2
2*(x + 1/3)^2
sage: (x + 1/3)*2
2*(x + 1/3)

comment:4 Changed 15 months ago by slelievre

  • Cc slelievre added
  • Milestone changed from sage-8.2 to sage-9.3

The upstream fix in Pynac was merged in Pynac 0.7.11.

The upgrade to Pynac 0.7.11 was done in #23820, merged in Sage 8.1.beta6.

In the present ticket we should add a doctest.

Last edited 15 months ago by slelievre (previous) (diff)

comment:5 Changed 8 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review.

comment:6 Changed 3 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

comment:7 Changed 5 weeks ago by slelievre

  • Cc gh-DaveWitteMorris added
Note: See TracTickets for help on using tickets.