From 055de7b8b7acd4b1d0c6339345edd22a9fe37b45 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 15 Aug 2008 15:04:23 +0200 Subject: [PATCH] Buffers: Update test-case strings, clean up endianness --- Cython/Compiler/Buffer.py | 12 ++++-------- tests/run/bufaccess.pyx | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) 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 -- 2.26.2