From: Andrea R. <ari...@pi...> - 2002-12-11 11:03:01
|
Hi, I've two question about PyArray_As2D function: 1) Looking at the source code I realized that the prototype given in the manual is different from that of the source: PyArray_As2D(PyObject *op, char **ptr, int *m, int *n, int type) (from manual) PyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int typecode) (from source) As far as I can understand the source version is correct while the manual's one is not. Am I wrong? 2) Next in the source code I've found the following memory allocation: data = (char **)malloc(n*sizeof(char *)); without checking if malloc return NULL or not. As far as I know it's not safe, even if it's very unlikely that this malloc would fail. Anyway in that case the following: ... data[i] = ap->data + i*ap->strides[0]; ... would cause the function to abort. Again am I wrong? Thanks in advance, Andrea. --- Andrea Riciputi <mailto:and...@li...> "Science is like sex: sometimes something useful comes out, but that is not the reason we are doing it" -- (Richard Feynman) |