Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
1a2d1558
Commit
1a2d1558
authored
Sep 17, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix crash in argument unpacking when receiving insufficient keyword arguments
parent
65f57569
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-2
tests/run/argerrors.py
tests/run/argerrors.py
+45
-0
No files found.
Cython/Compiler/Nodes.py
View file @
1a2d1558
...
@@ -2830,7 +2830,7 @@ class DefNode(FuncDefNode):
...
@@ -2830,7 +2830,7 @@ class DefNode(FuncDefNode):
# If we received kwargs, fill up the positional/required
# If we received kwargs, fill up the positional/required
# arguments with values from the kw dict
# arguments with values from the kw dict
code
.
putln
(
'
if (likely((kw_args = PyDict_Size(%s)) > 0)) {
'
%
Naming
.
kwds_cname
)
code
.
putln
(
'
kw_args = PyDict_Size(%s);
'
%
Naming
.
kwds_cname
)
if
self
.
num_required_args
or
max_positional_args
>
0
:
if
self
.
num_required_args
or
max_positional_args
>
0
:
last_required_arg
=
-
1
last_required_arg
=
-
1
for
i
,
arg
in
enumerate
(
all_args
):
for
i
,
arg
in
enumerate
(
all_args
):
...
@@ -2937,7 +2937,6 @@ class DefNode(FuncDefNode):
...
@@ -2937,7 +2937,6 @@ class DefNode(FuncDefNode):
self
.
name
))
self
.
name
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
def
generate_argument_conversion_code
(
self
,
code
):
def
generate_argument_conversion_code
(
self
,
code
):
# Generate code to convert arguments from signature type to
# Generate code to convert arguments from signature type to
...
...
tests/run/argerrors.py
0 → 100644
View file @
1a2d1558
# mode: run
def
test_single_arg
(
a
):
"""
>>> test_single_arg(1)
1
>>> test_single_arg() # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(1,2) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(**{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(*(), **{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
return
a
def
test_two_args
(
a
,
b
):
"""
>>> test_two_args(1,2)
(1, 2)
>>> test_two_args() # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1,2,3) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(**{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1, **{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(*(), **{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
return
a
,
b
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