diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 08:06:33 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 08:06:33 (GMT) |
| commit | 686c1f6915a52e181cc25247ba2ae9613ccfec66 (patch) | |
| tree | 17b43f5698d08215d5423978db0c62072a746811 /Lib/curses/ascii.py | |
| parent | b7fc5e42c505e7bc23215db7d97ec23673abac4f (diff) | |
| parent | 283de2b9c18e38c9a573526d6c398ade7dd6f8e9 (diff) | |
| download | cpython-686c1f6915a52e181cc25247ba2ae9613ccfec66.zip cpython-686c1f6915a52e181cc25247ba2ae9613ccfec66.tar.gz cpython-686c1f6915a52e181cc25247ba2ae9613ccfec66.tar.bz2 | |
Issue #9770: curses.ascii predicates now work correctly with negative integers.
Diffstat (limited to 'Lib/curses/ascii.py')
| -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): |
