numpy/numpy — pull request #4401 by meltingwax (2014-03-01 03:07:35+00:00)
Title: BUG: Fix infinite recursion in else case of __format__() implementation (fixes #4359)

This is my first contribution to NumPy, so any and all feedback is welcome.

Fixes #4359. When Python evaluates ``>>> "{}".format(some_generic_obj)``, the numpy ``gentype_format()`` C function is called. The existing code implements a set of pre-known types, and has an else case. The else case as implemented was calling ``PyObject_Format()``, which lead in infinite recursion. The new code handles the else case by calling ```PyObject_Str()``` on the object.