Closed thouis closed 11 years ago
atmention:teoliphant wrote on 2006-08-01
This is a problem with the mtrand Pyrex interface only. In particular it is a problem with the numpy.pxi file used in that interface. PyArray_ContiguousFromObject is used in mtrand.pyx but not specified in the numpy.pxi interface file.
Not all of the C-API is specified in the numpy.pxi file. Only the commands that are used.
PyArray_ContiguousFromObject is the old Numeric interface which is and will be supported by NumPy. It is not documented in the Guide to NumPy because there are other commands that are more flexible which replace it.
In particular, the PyArray_ContiguousFromObject always returns an ndarray object even if given a sub-class. The PyArray_ContiguousFromAny call can return a sub-class if one is given.
This is fixed in r2942
Original ticket http://projects.scipy.org/numpy/ticket/219 on 2006-08-01 by trac user TomLoredo, assigned to unknown.
C code that calls PyArray_ContiguousFromObject (both my own and within numpy) compiles fine but gives a NameError at runtime on Fedora Core 3 (Python 2.4.3). Calling random.set_state displays the bug. If I edit mtrand.pyx to change its 3 PyArray_ContiguousFromObject calls to PyArray_ContiguousFromAny, run generate_mtrand_c.py, and reinstall, the error goes away. A sample IPython session is copied below.
I deleted my previous numpy package from site-packages before installing this one.
I do not have this problem on OS X (10.3.9, MacPy 2.4.1).
I am unclear of the status of PyArray_ContiguousFromObject. It is no longer mentioned in the Guide To Numpy. Is it deprecated?
-Tom Loredo