re-pcre: Fix compatibility with big-endian systems.

pull/89/merge
Paul Sokolovsky 2016-12-08 14:35:48 +03:00
rodzic abddcd7893
commit 444004be32
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
import sys
import ffilib
import array
@ -67,7 +68,7 @@ class PCREPattern:
assert endpos == -1, "pos: %d, endpos: %d" % (pos, endpos)
buf = bytes(4)
pcre_fullinfo(self.obj, None, PCRE_INFO_CAPTURECOUNT, buf)
cap_count = int.from_bytes(buf)
cap_count = int.from_bytes(buf, sys.byteorder)
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: