From: Dag Sverre Seljebotn Date: Fri, 15 Aug 2008 13:04:23 +0000 (+0200) Subject: Buffers: Update test-case strings, clean up endianness X-Git-Tag: 0.9.8.1~41 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=055de7b8b7acd4b1d0c6339345edd22a9fe37b45;p=cython.git Buffers: Update test-case strings, clean up endianness --- diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index 0b3270ee..e53c5a4a 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -454,17 +454,13 @@ def get_ts_check_item(dtype, writer): char = dtype.typestring if char is not None: # Can use direct comparison - if char is 'O': - byteorder = '|' - else: - byteorder = '1' code = dedent("""\ - if (*ts == '%s') ++ts; + if (*ts == '1') ++ts; if (*ts != '%s') { - PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (expecting '%s' got '%%s')", ts); + PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (expected '%s', got '%%s')", ts); return NULL; } else return ts + 1; - """, 2) % (byteorder, char, char) + """, 2) % (char, char) else: # Cannot trust declared size; but rely on int vs float and # signed/unsigned to be correctly declared @@ -541,7 +537,7 @@ def get_getbuffer_code(dtype, code): ts = __Pyx_ConsumeWhitespace(ts); if (*ts != 0) { PyErr_Format(PyExc_ValueError, - "Expected non-struct buffer data type (rejecting on '%%s')", ts); + "Expected non-struct buffer data type (expected end, got '%%s')", ts); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; diff --git a/tests/run/bufaccess.pyx b/tests/run/bufaccess.pyx index 14fc95d4..9cd830a9 100644 --- a/tests/run/bufaccess.pyx +++ b/tests/run/bufaccess.pyx @@ -447,7 +447,7 @@ def fmtst1(buf): >>> fmtst1(IntMockBuffer("A", range(3))) Traceback (most recent call last): ... - ValueError: Buffer datatype mismatch (rejecting on 'i') + ValueError: Buffer datatype mismatch (expected 'f', got 'i') """ cdef object[float] a = buf @@ -457,7 +457,7 @@ def fmtst2(object[int] buf): >>> fmtst2(FloatMockBuffer("A", range(3))) Traceback (most recent call last): ... - ValueError: Buffer datatype mismatch (rejecting on 'f') + ValueError: Buffer datatype mismatch (expected 'i', got 'f') """ @testcase