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
3bb75c45
Commit
3bb75c45
authored
Oct 28, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more arg parsing fixes
parent
b7a4e7ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-4
tests/run/callargs.pyx
tests/run/callargs.pyx
+17
-1
No files found.
Cython/Compiler/Nodes.py
View file @
3bb75c45
...
...
@@ -1976,16 +1976,15 @@ class DefNode(FuncDefNode):
code
.
put
(
'case %2d: '
%
(
i
+
1
))
item
=
"PyTuple_GET_ITEM(%s, %d)"
%
(
Naming
.
args_cname
,
i
)
self
.
generate_arg_assignment
(
arg
,
item
,
code
)
if
min_positional_args
==
0
:
code
.
put
(
'case 0: '
)
code
.
putln
(
'break;'
)
if
self
.
star_arg
:
if
min_positional_args
:
code
.
putln
(
'break;'
)
for
i
in
range
(
min_positional_args
-
1
,
-
1
,
-
1
):
code
.
putln
(
'case %2d:'
%
i
)
code
.
put_goto
(
argtuple_error_label
)
else
:
if
min_positional_args
==
0
:
code
.
put
(
'case 0: '
)
code
.
putln
(
'break;'
)
code
.
put
(
'default: '
)
code
.
put_goto
(
argtuple_error_label
)
code
.
putln
(
'}'
)
...
...
tests/run/callargs.pyx
View file @
3bb75c45
...
...
@@ -110,9 +110,25 @@ __doc__ = u"""
1 2 0 1
>>> d(1,2,3, key=None)
1 2 1 1
>>> c()
10 20 0
>>> c(1)
1 20 0
>>> c(1,2)
1 2 0
>>> c(key=None)
10 20 1
>>> c(1, key=None)
1 20 1
>>> c(1,2, key=None)
1 2 1
"""
def
c
(
a
=
10
,
b
=
20
,
**
kwds
):
print
a
,
b
,
len
(
kwds
)
def
d
(
a
,
b
=
1
,
*
args
,
**
kwds
):
print
a
,
b
,
len
(
args
),
len
(
kwds
)
...
...
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