[Python-checkins] bpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)

T. Wouters webhook-mailer at python.org
Mon Sep 9 11:20:44 EDT 2019


https://github.com/python/cpython/commit/3cbc23aa229bc5ec04845053df78eae5f54e0497
commit: 3cbc23aa229bc5ec04845053df78eae5f54e0497
branch: master
author: Greg Price <gnprice at gmail.com>
committer: T. Wouters <thomas at python.org>
date: 2019-09-09T08:20:40-07:00
summary:

bpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)

Since PEP 393 in Python 3.3, this value is always 0x10ffff, the
maximum codepoint in Unicode; there's no longer such a thing as a
UCS-2 build of Python, which couldn't properly represent some
characters.

There are a couple of spots left where we still condition on the value
of this constant.  Take them out.

files:
M Lib/test/test_bigaddrspace.py
M Tools/unicode/mkstringprep.py

diff --git a/Lib/test/test_bigaddrspace.py b/Lib/test/test_bigaddrspace.py
index b639f68c2347..aa1f8ca75a98 100644
--- a/Lib/test/test_bigaddrspace.py
+++ b/Lib/test/test_bigaddrspace.py
@@ -55,7 +55,7 @@ def test_repeat(self):
 
 class StrTest(unittest.TestCase):
 
-    unicodesize = 2 if sys.maxunicode < 65536 else 4
+    unicodesize = 4
 
     @bigaddrspacetest
     def test_concat(self):
diff --git a/Tools/unicode/mkstringprep.py b/Tools/unicode/mkstringprep.py
index ead020c3a7a4..427188389a3b 100644
--- a/Tools/unicode/mkstringprep.py
+++ b/Tools/unicode/mkstringprep.py
@@ -1,9 +1,6 @@
-import re, sys
+import re
 from unicodedata import ucd_3_2_0 as unicodedata
 
-if sys.maxunicode == 65535:
-    raise RuntimeError("need UCS-4 Python")
-
 def gen_category(cats):
     for i in range(0, 0x110000):
         if unicodedata.category(chr(i)) in cats:



More information about the Python-checkins mailing list