fix isprintable() on space characters #5126

This commit is contained in:
Benjamin Peterson 2009-03-26 17:15:46 +00:00
parent 59406a9d85
commit 09832740d1
4 changed files with 952 additions and 947 deletions

View file

@ -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

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -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