id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
9652 Unnecesary and buggy code in arith.py mderickx mderickx "This code was added in #1148. I really think that the lines removed in my patch should be gone. The current (4.4.4) code is:
{{{
def valuation(m, p):
if hasattr(m, 'valuation'):
return m.valuation(p)
if is_FractionFieldElement(m):
return valuation(m.numerator()) - valuation(m.denominator())
if m == 0:
import sage.rings.all
return sage.rings.all.infinity
r = 0
power = p
while not (m % power): # m % power == 0
r += 1
power *= p
return r
}}}
Putting implementation specific to Fraction fields in a global function is bad practice. And since fraction fields have an implementation of valuation part of the above code will not be execucted. If it magicaly get's excecuted it will return bad results since it doesn't take into account the input variable ""p"" as it should.
Patches to apply in order:
1. smallfix1-arith_valuation.2.3.patch
2. smallfix1-arith_valuation-doctest.2.3.patch " defect closed minor sage-4.6 algebra fixed mstreng lftabera sage-4.6.alpha1 Maarten Derickx Marco Streng, John Cremona, Luis Felipe Tabera N/A