re-pcre: Actually fix compatibility with big-endian systems.

"big" argument to b"".from_bytes(..., "big") isn't really supported by
MicroPython, so use array as a buffer.
pull/142/head
Paul Sokolovsky 2016-12-19 23:05:38 +03:00
rodzic 6e0f020fcd
commit 7ccd2d87ed
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -66,9 +66,9 @@ class PCREPattern:
def search(self, s, pos=0, endpos=-1, _flags=0):
assert endpos == -1, "pos: %d, endpos: %d" % (pos, endpos)
buf = bytes(4)
buf = array.array('i', [0])
pcre_fullinfo(self.obj, None, PCRE_INFO_CAPTURECOUNT, buf)
cap_count = int.from_bytes(buf, sys.byteorder)
cap_count = buf[0]
ov = array.array('i', [0, 0, 0] * (cap_count + 1))
num = pcre_exec(self.obj, None, s, len(s), pos, _flags, ov, len(ov))
if num == -1: