
I reverted the changes I made to the pypy-pyarray branch that changed c-api functions like PyArray_NDIM(arr). The original code had no real answer to what happens if these are called when arr is not an ndarray. While the reviewers of the branch suggested that these should raise an exception if arr is not a ndarray, Amaury Forgeot d'Arc convinced me that we should be consistent with numpy (perhaps dangerous) practice since in numpy these functions are c-defined macros with no type checking and the numerous example uses scattered through the numpy source code as well as scipy contain no error checking. In fact error checking is not possible since there is no clear idea of what an error condition in the return value would look like. The discussion we had on IRC starts here http://www.tismer.com/pypy/irc-logs/pypy/pypy.2013-09-08.log.html#t22:15 so if my explanation is unclear please read the log. Any objections to keeping with the original numpy-compatible dangerous behaviour? Matti

Hi Matti I think it's fine to copy numpy's behaviour. Cheers Romain On Mon, Sep 9, 2013 at 9:37 PM, Matti Picus <matti.picus@gmail.com> wrote:
I reverted the changes I made to the pypy-pyarray branch that changed c-api functions like PyArray_NDIM(arr).
The original code had no real answer to what happens if these are called when arr is not an ndarray.
While the reviewers of the branch suggested that these should raise an exception if arr is not a ndarray, Amaury Forgeot d'Arc convinced me that we should be consistent with numpy (perhaps dangerous) practice since in numpy these functions are c-defined macros with no type checking and the numerous example uses scattered through the numpy source code as well as scipy contain no error checking.
In fact error checking is not possible since there is no clear idea of what an error condition in the return value would look like.
The discussion we had on IRC starts here http://www.tismer.com/pypy/irc-logs/pypy/pypy.2013-09-08.log.html#t22:15 so if my explanation is unclear please read the log.
Any objections to keeping with the original numpy-compatible dangerous behaviour? Matti _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev

Hi, On 09/09/13 21:37, Matti Picus wrote:
I reverted the changes I made to the pypy-pyarray branch that changed c-api functions like PyArray_NDIM(arr).
The original code had no real answer to what happens if these are called when arr is not an ndarray.
[cut]
The discussion we had on IRC starts here http://www.tismer.com/pypy/irc-logs/pypy/pypy.2013-09-08.log.html#t22:15 so if my explanation is unclear please read the log.
the discussion convinced me as well, so I think it's fine to leave things as they are now :) ciao, Anto
participants (3)
-
Antonio Cuni
-
Matti Picus
-
Romain Guillebert