numpy/numpy — pull request #435 by 87 (2012-09-11 21:41:04+00:00)
Title: Optimizations for dtype detection

Hi, these are a few small optimizations to PyArray_DTypeFromObjectHelper.

Use PyType checks to follow different code paths. This includes a general
PyNumber_Check for Python scalars and a PyObject_CheckBuffer check
to avoid running unnecessary buffer code. Also prioritize integer and long
checks in _array_find_python_scalar_type before float and complex, because
they have (much) faster type recognition (since Python 2.6).