ness01/sympy — pull request #3 by smichr (2012-01-20 14:41:54+00:00)
Title: in evalf routines in numbers, don't evalf unless foo is a number

In a few places, an evaluation was being performed and then a test
of whether the result is a number or not was being made. This caused
problems with the evalf routine which is expecting to work with numbers.

An example of a failure:

>>> b = Symbol('b', positive=True)
>>> oo**polar_lift(-b+1)
Traceback (most recent call last):
File "", line 1, in
File "sympy\core\decorators.py", line 65, in __sympifyit_wrapper
return func(a, sympify(b, strict=True))
File "sympy\core\decorators.py", line 105, in binary_op_wrapper
return func(self, other)
File "sympy\core\expr.py", line 129, in __pow__
return Pow(self, other)
File "sympy\core\cache.py", line 91, in wrapper
func_cache_it_cache[k] = r = func(*args, **kw_args)
File "sympy\core\power.py", line 84, in __new__
obj = b._eval_power(e)
File "sympy\core\numbers.py", line 1705, in _eval_power
n = exp.evalf()
File "sympy\core\evalf.py", line 1055, in evalf
result = evalf(self, prec+4, options)
File "sympy\core\evalf.py", line 986, in evalf
re = re._to_mpmath(prec, allow_ints=False)._mpf_
File "sympy\core\evalf.py", line 1122, in _to_mpmath
raise ValueError(errmsg)
ValueError: cannot convert to mpmath number