# HG changeset patch
# User Maarten Derickx <m.derickx.student@gmail.com>
# Date 1280775385 7200
# Node ID b9a43c0caad2f17a3e47b6404eda1a9e4e5a182d
# Parent 8dec8b43ccca5f104b1e280cb33c8f4c2c1b8f85
This if statement will always return false since fraction fields have an atribute valuation. Might the statement magically return true cause of some buggy other code. Then this will return a buggy restult since the argument p is not passed to the numerator and denominator.
diff r 8dec8b43ccca r b9a43c0caad2 sage/rings/arith.py
a

b


554  554  """ 
555  555  return ZZ(n).is_prime_power(flag=flag) 
556  556  
557   def valuation(m, p): 
 557  def valuation(m, p,*args1, **args2): 
558  558  """ 
559  559  The exact power of p that divides m. 
560  560  
… 
… 

596  596  sage: valuation(243*10007,10007) 
597  597  1 
598  598  """ 
599   if hasattr(m, 'valuation'): 
600   return m.valuation(p) 
601   if m == 0: 
602   import sage.rings.all 
603   return sage.rings.all.infinity 
604   if is_FractionFieldElement(m): 
605   return valuation(m.numerator())  valuation(m.denominator()) 
606   r = 0 
607   power = p 
608   while not (m % power): # m % power == 0 
609   r += 1 
610   power *= p 
611   return r 
 599  if isinstance(m,(int,long)): 
 600  m=Integer(m) 
 601  return m.valuation(p,*args1, **args2) 
612  602  
613  603  def prime_powers(start, stop=None): 
614  604  r""" 