Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3550dd3

Browse files
committed
Patch #442512: put block indices in the right byte order on bigendian systems.
1 parent 123cbd2 commit 3550dd3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/sre_compile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# See the sre.py file for information on usage and redistribution.
99
#
1010

11-
import _sre
11+
import _sre,sys
1212

1313
from sre_constants import *
1414

@@ -281,7 +281,10 @@ def _optimize_unicode(charset, fixup):
281281
header = [block]
282282
assert MAXCODE == 65535
283283
for i in range(128):
284-
header.append(mapping[2*i]+256*mapping[2*i+1])
284+
if sys.byteorder == 'big':
285+
header.append(256*mapping[2*i]+mapping[2*i+1])
286+
else:
287+
header.append(mapping[2*i]+256*mapping[2*i+1])
285288
data[0:0] = header
286289
return [(BIGCHARSET, data)]
287290

0 commit comments

Comments
 (0)