Fix some issues with Sage + mpmath + gmpy
Fix some issues with Sage + mpmath + gmpy

When Sage is installed, mpmath uses it as a backend. This causes problem when
Sage integers are passed to gmpy functions, which only work with Python ints,
gmpy ints, or strings.

kaushik94/sympy,kaushik94/sympy,kaushik94/sympy