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
504373c5
Commit
504373c5
authored
Jul 11, 2018
by
Serhiy Storchaka
Committed by
GitHub
Jul 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192)
parent
b91a3a0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
Lib/test/test_capi.py
Lib/test/test_capi.py
+32
-0
Misc/NEWS.d/next/C API/2018-07-09-11-39-54.bpo-23927.pDFkxb.rst
...EWS.d/next/C API/2018-07-09-11-39-54.bpo-23927.pDFkxb.rst
+2
-0
Python/getargs.c
Python/getargs.c
+3
-1
No files found.
Lib/test/test_capi.py
View file @
504373c5
...
...
@@ -6,6 +6,7 @@ import os
import
pickle
import
random
import
re
import
string
import
subprocess
import
sys
import
sysconfig
...
...
@@ -489,6 +490,37 @@ class SkipitemTest(unittest.TestCase):
c
,
i
,
when_skipped
,
when_not_skipped
))
self
.
assertIs
(
when_skipped
,
when_not_skipped
,
message
)
def
test_skipitem_with_suffix
(
self
):
parse
=
_testcapi
.
parse_tuple_and_keywords
empty_tuple
=
()
tuple_1
=
(
0
,)
dict_b
=
{
'b'
:
1
}
keywords
=
[
"a"
,
"b"
]
supported
=
(
's#'
,
's*'
,
'z#'
,
'z*'
,
'u#'
,
'Z#'
,
'y#'
,
'y*'
,
'w#'
,
'w*'
)
for
c
in
string
.
ascii_letters
:
for
c2
in
'#*'
:
f
=
c
+
c2
with
self
.
subTest
(
format
=
f
):
optional_format
=
"|"
+
f
+
"i"
if
f
in
supported
:
parse
(
empty_tuple
,
dict_b
,
optional_format
,
keywords
)
else
:
with
self
.
assertRaisesRegex
(
SystemError
,
'impossible<bad format char>'
):
parse
(
empty_tuple
,
dict_b
,
optional_format
,
keywords
)
for
c
in
map
(
chr
,
range
(
32
,
128
)):
f
=
'e'
+
c
optional_format
=
"|"
+
f
+
"i"
with
self
.
subTest
(
format
=
f
):
if
c
in
'st'
:
parse
(
empty_tuple
,
dict_b
,
optional_format
,
keywords
)
else
:
with
self
.
assertRaisesRegex
(
SystemError
,
'impossible<bad format char>'
):
parse
(
empty_tuple
,
dict_b
,
optional_format
,
keywords
)
def
test_parse_tuple_and_keywords
(
self
):
# Test handling errors in the parse_tuple_and_keywords helper itself
self
.
assertRaises
(
TypeError
,
_testcapi
.
parse_tuple_and_keywords
,
...
...
Misc/NEWS.d/next/C API/2018-07-09-11-39-54.bpo-23927.pDFkxb.rst
0 → 100644
View file @
504373c5
Fixed :exc:`SystemError` in :c:func:`PyArg_ParseTupleAndKeywords` when the
``w*`` format unit is used for optional parameter.
Python/getargs.c
View file @
504373c5
...
...
@@ -2333,7 +2333,9 @@ skipitem(const char **p_format, va_list *p_va, int flags)
(
void
)
va_arg
(
*
p_va
,
int
*
);
}
format
++
;
}
else
if
((
c
==
's'
||
c
==
'z'
||
c
==
'y'
)
&&
*
format
==
'*'
)
{
}
else
if
((
c
==
's'
||
c
==
'z'
||
c
==
'y'
||
c
==
'w'
)
&&
*
format
==
'*'
)
{
format
++
;
}
break
;
...
...
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