Merge pull request #2042 from jepler/qstr-expansion
makeqstrdata: permit longer "compressed" outputs
This commit is contained in:
commit
47a0b7cba1
@ -180,7 +180,7 @@ def compress(encoding_table, decompressed):
|
|||||||
if not isinstance(decompressed, bytes):
|
if not isinstance(decompressed, bytes):
|
||||||
raise TypeError()
|
raise TypeError()
|
||||||
values, lengths = encoding_table
|
values, lengths = encoding_table
|
||||||
enc = bytearray(len(decompressed))
|
enc = bytearray(len(decompressed) * 2)
|
||||||
#print(decompressed)
|
#print(decompressed)
|
||||||
#print(lengths)
|
#print(lengths)
|
||||||
current_bit = 7
|
current_bit = 7
|
||||||
@ -227,6 +227,8 @@ def compress(encoding_table, decompressed):
|
|||||||
current_bit -= 1
|
current_bit -= 1
|
||||||
if current_bit != 7:
|
if current_bit != 7:
|
||||||
current_byte += 1
|
current_byte += 1
|
||||||
|
if current_byte > len(decompressed):
|
||||||
|
print("Note: compression increased length", repr(decompressed.decode('utf-8')), len(decompressed), current_byte, file=sys.stderr)
|
||||||
return enc[:current_byte]
|
return enc[:current_byte]
|
||||||
|
|
||||||
def qstr_escape(qst):
|
def qstr_escape(qst):
|
||||||
|
Loading…
Reference in New Issue
Block a user