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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
871351b5
Commit
871351b5
authored
Aug 25, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: passing all positional arguments as kw-args was broken
parent
e3d6767d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-6
tests/run/kwonlyargscall.pyx
tests/run/kwonlyargscall.pyx
+18
-0
No files found.
Cython/Compiler/Nodes.py
View file @
871351b5
...
@@ -1756,12 +1756,8 @@ class DefNode(FuncDefNode):
...
@@ -1756,12 +1756,8 @@ class DefNode(FuncDefNode):
code
.
putln
(
'case %d:'
%
(
i
+
1
))
code
.
putln
(
'case %d:'
%
(
i
+
1
))
code
.
putln
(
"values[%d] = PyTuple_GET_ITEM(%s, %d);"
%
(
code
.
putln
(
"values[%d] = PyTuple_GET_ITEM(%s, %d);"
%
(
i
,
Naming
.
args_cname
,
i
))
i
,
Naming
.
args_cname
,
i
))
if
self
.
star_arg
:
code
.
putln
(
'case 0: break;'
)
code
.
putln
(
'case 0: break;'
)
if
not
self
.
star_arg
:
else
:
if
min_positional_args
==
0
:
code
.
putln
(
'case 0:'
)
code
.
putln
(
'break;'
)
code
.
put
(
'default: '
)
# more arguments than allowed
code
.
put
(
'default: '
)
# more arguments than allowed
code
.
put_goto
(
argtuple_error_label
)
code
.
put_goto
(
argtuple_error_label
)
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
...
...
tests/run/kwonlyargscall.pyx
View file @
871351b5
__doc__
=
u"""
__doc__
=
u"""
>>> call0abc(b)
1 2 3
>>> call3(b)
>>> call3(b)
1 2 3
1 2 3
>>> call4(b)
>>> call4(b)
Traceback (most recent call last):
Traceback (most recent call last):
TypeError: b() takes exactly 3 positional arguments (4 given)
TypeError: b() takes exactly 3 positional arguments (4 given)
>>> call0ab(c)
1 2 1
>>> call0abc(c)
1 2 3
>>> call2(c)
>>> call2(c)
1 2 1
1 2 1
>>> call3(c)
>>> call3(c)
...
@@ -13,6 +19,8 @@ __doc__ = u"""
...
@@ -13,6 +19,8 @@ __doc__ = u"""
Traceback (most recent call last):
Traceback (most recent call last):
TypeError: c() takes at most 3 positional arguments (4 given)
TypeError: c() takes at most 3 positional arguments (4 given)
>>> call0abc(d)
1 2 3
>>> call2(d)
>>> call2(d)
1 2 88
1 2 88
>>> call2c(d)
>>> call2c(d)
...
@@ -25,6 +33,8 @@ __doc__ = u"""
...
@@ -25,6 +33,8 @@ __doc__ = u"""
Traceback (most recent call last):
Traceback (most recent call last):
TypeError: 'd' is an invalid keyword argument for this function
TypeError: 'd' is an invalid keyword argument for this function
>>> call0abc(e)
1 2 3 []
>>> call2(e)
>>> call2(e)
1 2 88 []
1 2 88 []
>>> call2c(e)
>>> call2c(e)
...
@@ -39,6 +49,8 @@ __doc__ = u"""
...
@@ -39,6 +49,8 @@ __doc__ = u"""
Traceback (most recent call last):
Traceback (most recent call last):
TypeError: e() takes at most 3 positional arguments (4 given)
TypeError: e() takes at most 3 positional arguments (4 given)
>>> call0abc(f)
1 2 3 42
>>> call2c(f)
>>> call2c(f)
1 2 1 42
1 2 1 42
>>> call2cd(f)
>>> call2cd(f)
...
@@ -106,6 +118,12 @@ __doc__ = u"""
...
@@ -106,6 +118,12 @@ __doc__ = u"""
# the calls:
# the calls:
def
call0ab
(
f
):
f
(
a
=
1
,
b
=
2
)
def
call0abc
(
f
):
f
(
a
=
1
,
b
=
2
,
c
=
3
)
def
call2
(
f
):
def
call2
(
f
):
f
(
1
,
2
)
f
(
1
,
2
)
...
...
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