From 96bbe67647327984c59b86212283970a270f8513 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Sat, 24 Nov 2018 17:29:59 -0500 Subject: [PATCH] Move the Python 2 character array case first This makes it a little easier to read the code either in Cython or its C equivalent. --- src/cybuffer.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cybuffer.pyx b/src/cybuffer.pyx index 30bf1bb..5bd0543 100644 --- a/src/cybuffer.pyx +++ b/src/cybuffer.pyx @@ -188,13 +188,13 @@ cdef class cybuffer(object): # Cast to appropriate format fmt = self._format[0] - if fmt == 'u' or fmt == 'w': + if PY2K and fmt == 'c': + self._format = UINT8_TC + elif fmt == 'u' or fmt == 'w': if self.itemsize == 2: self._format = UINT16_TC elif self.itemsize == 4: self._format = UINT32_TC - elif PY2K and fmt == 'c': - self._format = UINT8_TC # Adjust shape and strides based on casting if PY2K and self.itemsize != 1: