On 02/17/2011 07:11 PM, Lisandro Dalcin wrote:
I'm working on a patch to get old, recent, and dev NumPy working in
2.7/3.x. So far, I had success, but I still have two failures like the
one pasted below.
Dag, could you elaborate a bit about the purpose of
__Pyx_BufFmt_CheckString() ? It is just a validity check for pep 3118
format strings? Do you expect the failure below to be hard to fix?s.
Yes, it compares the string with the RTTI that is saved for the type
that is expected by the code.
I remember there was something about the '=' specifier that meant it was
not completely trivial to fix, but still, it's just about doing it. The
code in question is a bit convoluted; the reason I did that is because I
wanted to allow things to match if the binary layouts matched even if
the 'struct structure' wasn't the same...
As for user code, a quick hack around this is 'cast=True' in the buffer
spec.
Please file a bug...
Dag Sverre
Just in case, the format string that triggers the failure is:
memoryview(np.zeros((1,), dtype=np.dtype('b,i', align=False))).format
'T{b:f0:=i:f1:}'
======================================================================
FAIL: numpy_test ()
Doctest: numpy_test
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/python/3.2/lib/python3.2/doctest.py", line 2113, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for numpy_test
File "/u/dalcinl/Devel/Cython/cython/BUILD/run/c/numpy_test.cpython-32dm.so",
line 1, in numpy_test
----------------------------------------------------------------------
File "/u/dalcinl/Devel/Cython/cython/BUILD/run/c/numpy_test.cpython-32dm.so",
line 155, in numpy_test
Failed example:
print(test_packed_align(np.zeros((1,), dtype=np.dtype('b,i',
align=False))))
Exception raised:
Traceback (most recent call last):
File "/usr/local/python/3.2/lib/python3.2/doctest.py", line 1248, in
__run
compileflags, 1), test.globs)
File "<doctest numpy_test[64]>", line 1, in<module>
print(test_packed_align(np.zeros((1,), dtype=np.dtype('b,i',
align=False))))
File "numpy_test.pyx", line 404, in numpy_test.test_packed_align
(numpy_test.c:6367)
ValueError: Buffer packing mode currently only allowed at
beginning of format string (this is a defect)
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel