summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-10-18 17:34:18 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-10-18 17:34:18 (GMT)
commit99ac3283e74d8d33479f9ef58a018b0d9a25e3b3 (patch)
treef53ec492ebc0f64050a98cbe3ef66823e6f001f0 /Tools
parentd8eeeae4a6d2c9d6cd412154fcfaa68d24fe6145 (diff)
downloadcpython-99ac3283e74d8d33479f9ef58a018b0d9a25e3b3.zip
cpython-99ac3283e74d8d33479f9ef58a018b0d9a25e3b3.tar.gz
cpython-99ac3283e74d8d33479f9ef58a018b0d9a25e3b3.tar.bz2
Verify that lower-higher case delta are 16-bit.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/unicode/makeunicodedata.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index 5e949b3..3b2fd11 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -223,15 +223,21 @@ def makeunicodetype(unicode, trace):
flags |= UPPER_MASK
# use delta predictor for upper/lower/title
if record[12]:
- upper = (int(record[12], 16) - char) & 0xffff
+ upper = int(record[12], 16) - char
+ assert -32768 <= upper <= 32767
+ upper = upper & 0xffff
else:
upper = 0
if record[13]:
- lower = (int(record[13], 16) - char) & 0xffff
+ lower = int(record[13], 16) - char
+ assert -32768 <= lower <= 32767
+ lower = lower & 0xffff
else:
lower = 0
if record[14]:
- title = (int(record[14], 16) - char) & 0xffff
+ title = int(record[14], 16) - char
+ assert -32768 <= lower <= 32767
+ title = title & 0xffff
else:
title = 0
# decimal digit, integer digit
@@ -322,6 +328,8 @@ def makeunicodename(unicode, trace):
wordlist = words.items()
# sort on falling frequency
+ # XXX: different Python versions produce a different order
+ # for words with equal frequency
wordlist.sort(lambda a, b: len(b[1])-len(a[1]))
# figure out how many phrasebook escapes we need