summaryrefslogtreecommitdiffstats
path: root/Tools/unicode
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-07-04 15:55:02 (GMT)
committerGeorg Brandl <georg@python.org>2008-07-04 15:55:02 (GMT)
commitd52429fb4957e0acdf36540705bd9ea859070fc5 (patch)
treeee88a6e46bf98c7cea73c8268d063e5a0d80b008 /Tools/unicode
parent6e7196fb933f24abc915e9c20b9fa676a04b82c5 (diff)
downloadcpython-d52429fb4957e0acdf36540705bd9ea859070fc5.zip
cpython-d52429fb4957e0acdf36540705bd9ea859070fc5.tar.gz
cpython-d52429fb4957e0acdf36540705bd9ea859070fc5.tar.bz2
Issue #3282: str.isprintable() should return False for undefined Unicode characters.
Diffstat (limited to 'Tools/unicode')
-rw-r--r--Tools/unicode/makeunicodedata.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index 52839e6..88ed002 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -20,7 +20,7 @@
# 2002-11-25 mvl add UNIDATA_VERSION
# 2004-05-29 perky add east asian width information
# 2006-03-10 mvl update to Unicode 4.1; add UCD 3.2 delta
-# 2008-06-11 gb add NONPRINTABLE_MASK for Atsuo Ishimoto's ascii() patch
+# 2008-06-11 gb add PRINTABLE_MASK for Atsuo Ishimoto's ascii() patch
#
# written by Fredrik Lundh (fredrik@pythonware.com)
#
@@ -61,7 +61,7 @@ TITLE_MASK = 0x40
UPPER_MASK = 0x80
XID_START_MASK = 0x100
XID_CONTINUE_MASK = 0x200
-NONPRINTABLE_MASK = 0x400
+PRINTABLE_MASK = 0x400
def maketables(trace=0):
@@ -373,10 +373,8 @@ def makeunicodetype(unicode, trace):
flags |= TITLE_MASK
if category == "Lu":
flags |= UPPER_MASK
- if category[0] == "C":
- flags |= NONPRINTABLE_MASK
- if category[0] == "Z" and char != " ":
- flags |= NONPRINTABLE_MASK
+ if char == " " or category[0] not in ("C", "Z"):
+ flags |= PRINTABLE_MASK
if "XID_Start" in properties:
flags |= XID_START_MASK
if "XID_Continue" in properties: