summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorNathaniel J. Smith <njs@pobox.com>2012-05-15 18:32:14 +0100
committerNathaniel J. Smith <njs@pobox.com>2012-05-15 18:48:08 +0100
commit6a90adaea6ba4330e8da4db546425d9cdcc5a940 (patch)
tree46ba8a1b87620db81c1a1f3d7217380f0c675eac /numpy/core/numeric.py
parentcbce4e6565e7a7fbe065502b264622ce7d64740a (diff)
downloadnumpy-6a90adaea6ba4330e8da4db546425d9cdcc5a940.tar.gz
Funnel all assignments to PyArrayObject->base through a single point
This patch removes all direct assignments of non-NULL values to the 'base' field on PyArrayObjects. A new utility function was created to set up UPDATEIFCOPY arrays, and all assignments to 'base' were adjusted to use either PyArray_SetBaseObject or the new PyArray_SetUpdateIfCopyBase. One advantage of this is that it produces more consistent error handling. This error handling revealed a bug in the nditer code, which this patch does *not* yet fix. The bug is that npyiter_new_temp_array sometimes (when dealing with reversed axes) creates an array and then returns a view onto it. But, npyiter_allocate_arrays assumes that the array returned by npyiter_new_temp_array can have UPDATEIFCOPY set, which requires reassigning its 'base' field. Previously, this meant that the temporary array leaked. Now, it produces a ValueError. This code path doesn't seem to actually be hit very often; only one of the nditer tests fails because of the change. See numpy/core/tests/test_nditer.py:test_iter_array_cast_buggy
Diffstat (limited to 'numpy/core/numeric.py')
0 files changed, 0 insertions, 0 deletions