summaryrefslogtreecommitdiff
path: root/Lib/curses
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-28 10:04:27 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-28 10:04:27 +0200
commitd6a72ded52bf3bf44f4533f927a60206884eb54b (patch)
treeb85b382a20a9a784ea697a6d45ad4ec5600beb6f /Lib/curses
parent9ae14e605a9b8d6a25a7e2640ef91a499ae479ad (diff)
downloadcpython-d6a72ded52bf3bf44f4533f927a60206884eb54b.tar.gz
Issue #9770: curses.ascii predicates now work correctly with negative integers.
Diffstat (limited to 'Lib/curses')
-rw-r--r--Lib/curses/ascii.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py
index 6a466e0078..5b243be681 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):