Opened 3 years ago

Last modified 3 months ago

#23304 new defect

hold=True does not always prevent evaluation

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

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 (4)

comment:1 Changed 3 years ago by rws

See also #21754 and #21758.

comment:2 Changed 3 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 3 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 3 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 3 months ago by slelievre (previous) (diff)
Note: See TracTickets for help on using tickets.