diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 08:04:27 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 08:04:27 (GMT) |
commit | 283de2b9c18e38c9a573526d6c398ade7dd6f8e9 (patch) | |
tree | 3804c8870fca8b8bac7b9328e58284ad471c7977 /Lib/curses | |
parent | c9ad8b7a2384f063dc0a99c652dccd9e7616e14e (diff) | |
download | cpython-283de2b9c18e38c9a573526d6c398ade7dd6f8e9.zip cpython-283de2b9c18e38c9a573526d6c398ade7dd6f8e9.tar.gz cpython-283de2b9c18e38c9a573526d6c398ade7dd6f8e9.tar.bz2 |
Issue #9770: curses.ascii predicates now work correctly with negative integers.
Diffstat (limited to 'Lib/curses')
-rw-r--r-- | Lib/curses/ascii.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py index 6a466e0..5b243be 100644 --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -53,19 +53,19 @@ def _ctoi(c): def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return 0 <= _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (9, 32) -def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 -def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 -def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 -def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 -def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 +def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127 +def isdigit(c): return 48 <= _ctoi(c) <= 57 +def isgraph(c): return 33 <= _ctoi(c) <= 126 +def islower(c): return 97 <= _ctoi(c) <= 122 +def isprint(c): return 32 <= _ctoi(c) <= 126 def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) -def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 +def isupper(c): return 65 <= _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ - (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) -def isctrl(c): return _ctoi(c) < 32 + (65 <= _ctoi(c) <= 70) or (97 <= _ctoi(c) <= 102) +def isctrl(c): return 0 <= _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): |