numpy/numpy — pull request #2831 by certik (2012-12-15 23:27:38+00:00)
Title: FIX: Fixes the segfault in PyArray_FromScalar

The problem was that PyArray_NewFromDescr() steals a reference to typecode and
so any further usage of it is undefined. Apparently this bug only appeared in
debug version of Python 3.2. The fix is to simply INCREF typecode and then
carefully DECREF it at each possible exit from the function.

Fixes gh-2738.