Fixes to "Fix Numpy 1.20.0 by initializing PyArray_Descr portably"
- 'pdescr' must be derived from NPY_VOID. The C arrays being viewed contain arbitrary C data (which are wrapped by Python objects on the fly), not the Python objects themselves (for which NPY_OBJECT would be used). - Restore flags and other settings from the static PyArray_Descr initialisation. Some (e.g. 'byteorder') likely already have sensible defaults, but better safe than sorry. - Remove 'NPY_ITEM_IS_POINTER' from 'flags'. It is essentially deprecated by Numpy 1.20.0, and in any case appears not to be needed, as the logic of what elements are "pointers" is already handled by SWIG. Since we don't need this flag, we also don't need the hard-coded 'names' and 'fields'. (I imagine this would break a number of things by forcing access to SWIG objects through the 'swigobj' field, but never got this working so couldn't test it out.) - Restore the 'Py_INCREF(*pdescr)' before returning 'pdescr'. This is CRITICAL otherwise, ...
Showing with 11 additions and 7 deletions