Skip to content

Commit 444004b

Browse files
committed
re-pcre: Fix compatibility with big-endian systems.
1 parent abddcd7 commit 444004b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

re-pcre/re.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import ffilib
23
import array
34

@@ -67,7 +68,7 @@ def search(self, s, pos=0, endpos=-1, _flags=0):
6768
assert endpos == -1, "pos: %d, endpos: %d" % (pos, endpos)
6869
buf = bytes(4)
6970
pcre_fullinfo(self.obj, None, PCRE_INFO_CAPTURECOUNT, buf)
70-
cap_count = int.from_bytes(buf)
71+
cap_count = int.from_bytes(buf, sys.byteorder)
7172
ov = array.array('i', [0, 0, 0] * (cap_count + 1))
7273
num = pcre_exec(self.obj, None, s, len(s), pos, _flags, ov, len(ov))
7374
if num == -1:

0 commit comments

Comments
 (0)