Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
686c1f69
Commit
686c1f69
authored
Dec 28, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #9770: curses.ascii predicates now work correctly with negative integers.
parents
b7fc5e42
283de2b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
+31
-9
Lib/curses/ascii.py
Lib/curses/ascii.py
+9
-9
Lib/test/test_curses.py
Lib/test/test_curses.py
+19
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/curses/ascii.py
View file @
686c1f69
...
...
@@ -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
):
...
...
Lib/test/test_curses.py
View file @
686c1f69
...
...
@@ -436,6 +436,25 @@ class TestAscii(unittest.TestCase):
check
(
curses
.
ascii
.
ispunct
,
c
in
string
.
punctuation
)
check
(
curses
.
ascii
.
isxdigit
,
c
in
string
.
hexdigits
)
for
i
in
(
-
2
,
-
1
,
256
,
sys
.
maxunicode
,
sys
.
maxunicode
+
1
):
self
.
assertFalse
(
curses
.
ascii
.
isalnum
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isalpha
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isdigit
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
islower
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isspace
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isupper
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isascii
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isctrl
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
iscntrl
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isblank
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isgraph
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isprint
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
ispunct
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
isxdigit
(
i
))
self
.
assertFalse
(
curses
.
ascii
.
ismeta
(
-
1
))
def
test_ascii
(
self
):
ascii
=
curses
.
ascii
.
ascii
self
.
assertEqual
(
ascii
(
'
\
xc1
'
),
'A'
)
...
...
Misc/NEWS
View file @
686c1f69
...
...
@@ -40,6 +40,9 @@ Core and Builtins
Library
-------
- Issue #9770: curses.ascii predicates now work correctly with negative
integers.
- Issue #28427: old keys should not remove new values from
WeakValueDictionary when collecting from another thread.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment