From: Greg Price Date: Tue, 13 Aug 2019 05:59:30 +0000 (-0700) Subject: bpo-37760: Constant-fold some old options in makeunicodedata. (GH-15129) X-Git-Tag: v3.9.0a1~881 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99d208efed97e02d813e8166925b998bbd0d3993;p=thirdparty%2FPython%2Fcpython.git bpo-37760: Constant-fold some old options in makeunicodedata. (GH-15129) The `expand` option was introduced in 2000 in commit fad27aee1. It appears to have been always set since it was committed, and what it does is tell the code to do something essential. So, just always do that, and cut the option. Also cut the `linebreakprops` option, which isn't consulted anymore. --- diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py index 1be93ec479c8..38c1f19a6567 100644 --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -943,10 +943,7 @@ class UnicodeData: # ISO-comment, uppercase, lowercase, titlecase, ea-width, (16) # derived-props] (17) - def __init__(self, version, - linebreakprops=False, - expand=1, - cjk_check=True): + def __init__(self, version, cjk_check=True): self.changed = [] table = [None] * 0x110000 for s in UcdFile(UNICODE_DATA, version): @@ -956,26 +953,25 @@ class UnicodeData: cjk_ranges_found = [] # expand first-last ranges - if expand: - field = None - for i in range(0, 0x110000): - s = table[i] - if s: - if s[1][-6:] == "First>": - s[1] = "" - field = s - elif s[1][-5:] == "Last>": - if s[1].startswith("": + s[1] = "" + field = s + elif s[1][-5:] == "Last>": + if s[1].startswith("