sympy/sympy — pull request #1540 by smichr (2012-09-21 04:10:20+00:00)
Title: 3393: _random returns None when eval fails

equals tries randomly evaluating the expression. Without a good way to know the domain in which to guess, sometimes it guesses in an invalid domain for which evalf fails. In this case, when a negative value for n is chosen, evalf fails. A hack is to watch for this in _random and just bail when this happens.