Commit 09832740 authored by Benjamin Peterson's avatar Benjamin Peterson

fix isprintable() on space characters #5126

parent 59406a9d
...@@ -424,6 +424,7 @@ class UnicodeTest( ...@@ -424,6 +424,7 @@ class UnicodeTest(
def test_isprintable(self): def test_isprintable(self):
self.assertTrue("".isprintable()) self.assertTrue("".isprintable())
self.assertTrue(" ".isprintable())
self.assertTrue("abcdefg".isprintable()) self.assertTrue("abcdefg".isprintable())
self.assertFalse("abcdefg\n".isprintable()) self.assertFalse("abcdefg\n".isprintable())
# some defined Unicode character # some defined Unicode character
......
...@@ -12,6 +12,8 @@ What's New in Python 3.1 alpha 2? ...@@ -12,6 +12,8 @@ What's New in Python 3.1 alpha 2?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #5126: str.isprintable() returned False for space characters.
- Issue #4688: Add a heuristic so that tuples and dicts containing only - Issue #4688: Add a heuristic so that tuples and dicts containing only
untrackable objects are not tracked by the garbage collector. This can untrackable objects are not tracked by the garbage collector. This can
reduce the size of collections and therefore the garbage collection overhead reduce the size of collections and therefore the garbage collection overhead
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -375,7 +375,7 @@ def makeunicodetype(unicode, trace): ...@@ -375,7 +375,7 @@ def makeunicodetype(unicode, trace):
flags |= TITLE_MASK flags |= TITLE_MASK
if category == "Lu": if category == "Lu":
flags |= UPPER_MASK flags |= UPPER_MASK
if char == " " or category[0] not in ("C", "Z"): if char == ord(" ") or category[0] not in ("C", "Z"):
flags |= PRINTABLE_MASK flags |= PRINTABLE_MASK
if "XID_Start" in properties: if "XID_Start" in properties:
flags |= XID_START_MASK flags |= XID_START_MASK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment