diff --git a/re-pcre/re.py b/re-pcre/re.py index eb1dc075..be2f23d7 100644 --- a/re-pcre/re.py +++ b/re-pcre/re.py @@ -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: