Previously it was try/except block over several commands it was checking for KeyError, which is a bad style, as that error can occur anywhere. It was supposed to occur in the first line, but in fact, sometimes it occured in the second line. This was fixed by this patch.
Signed-off-by: Ondrej Certik <ond...@certik.cz> --- sympy/core/evalf.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py index 474fb7d..6ce9642 100644 --- a/sympy/core/evalf.py +++ b/sympy/core/evalf.py @@ -884,6 +884,8 @@ def evalf_sum(expr, prec, options): #----------------------------------------------------------------------------# def evalf_symbol(x, prec, options): + if not 'subs' in options: + raise NotImplementedError() val = options['subs'][x] if isinstance(val, mpf): if not val: @@ -945,11 +947,10 @@ def _create_evalf_table(): } def evalf(x, prec, options): - try: - rf = evalf_table[x.func] + rf = evalf_table.get(x.func, None) + if rf is not None: r = rf(x, prec, options) - except KeyError: - #r = finalize_complex(x._eval_evalf(prec)._mpf_, fzero, prec) + else: try: # Fall back to ordinary evalf if possible if 'subs' in options: -- 1.6.2.1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---