From 9a196b689b68c61ebd6cdba14d9e227ea3218696 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Sat, 3 Aug 2019 21:47:19 -0700 Subject: [PATCH] bpo-37760: Constant-fold some old options in makeunicodedata. 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. --- Tools/unicode/makeunicodedata.py | 44 +++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py index 5b9427acd39003..e93e6c8c5ce4de 100644 --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -916,10 +916,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 with open_data(UNICODE_DATA, version) as file: @@ -934,26 +931,25 @@ def __init__(self, version, 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("