Hi,

I'm a bit confused about the memory views feature and I hope that you
can help me out...

When I cythonize the following code in my bt.pyx file and run the test
below with Python 2.7.1 and NumPy 1.7.1 everything works fine, but when
I try Python 2.6.6 and NumPy 1.3.0 I get the following exception:

def bar(int[:] z):
    print(z)

>>> import bt
>>> import numpy
>>> x = numpy.array([1,2,3], dtype=numpy.int32) 
>>> bt.bar(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bt.pyx", line 10, in bt.bar (bt.c:1585)
  File "stringsource", line 619, in View.MemoryView.memoryview_cwrapper 
(bt.c:7263)
  File "stringsource", line 327, in View.MemoryView.memoryview.__cinit__ 
(bt.c:4028)
TypeError: 'numpy.ndarray' does not have the buffer interface

Is there a minimum version of Python and/or NumPy that should be
installed for this feature to work? If yes, would it be possible to
include a compile-time check for that?

Unfortunately, I couldn't find anything regarding the minimally required
versions in the documentation...

Thanks!

-- 
Sincerely yours,
Yury V. Zaytsev


_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to