mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848.
Backported to 2.3.
This commit is contained in:
parent
156c49ad1c
commit
7d9c6c7e8c
3 changed files with 15 additions and 4 deletions
|
|
@ -333,14 +333,16 @@ def _optimize_unicode(charset, fixup):
|
|||
block = block + 1
|
||||
data = data + _mk_bitmap(chunk)
|
||||
header = [block]
|
||||
if MAXCODE == 65535:
|
||||
if _sre.CODESIZE == 2:
|
||||
code = 'H'
|
||||
else:
|
||||
code = 'L'
|
||||
code = 'I'
|
||||
# Convert block indices to byte array of 256 bytes
|
||||
mapping = array.array('b', mapping).tostring()
|
||||
# Convert byte array to word array
|
||||
header = header + array.array(code, mapping).tolist()
|
||||
mapping = array.array(code, mapping)
|
||||
assert mapping.itemsize == _sre.CODESIZE
|
||||
header = header + mapping.tolist()
|
||||
data[0:0] = header
|
||||
return [(BIGCHARSET, data)]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue