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
Gwenaël Samain
cython
Commits
f5c14c1c
Commit
f5c14c1c
authored
Jan 18, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent DefNode inlining for signatures with kwonly arguments
parent
497e35f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
tests/run/closure_inlining.pyx
tests/run/closure_inlining.pyx
+21
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
f5c14c1c
...
@@ -5069,6 +5069,8 @@ class InlinedDefNodeCallNode(CallNode):
...
@@ -5069,6 +5069,8 @@ class InlinedDefNodeCallNode(CallNode):
return
False
return
False
if
len
(
func_type
.
args
)
!=
len
(
self
.
args
):
if
len
(
func_type
.
args
)
!=
len
(
self
.
args
):
return
False
return
False
if
func_type
.
num_kwonly_args
:
return
False
# actually wrong number of arguments
return
True
return
True
def
analyse_types
(
self
,
env
):
def
analyse_types
(
self
,
env
):
...
...
tests/run/closure_inlining.pyx
View file @
f5c14c1c
...
@@ -72,6 +72,27 @@ def test_defaults(a, b):
...
@@ -72,6 +72,27 @@ def test_defaults(a, b):
return
a
,
b
,
c
return
a
,
b
,
c
return
inner
(
a
)
return
inner
(
a
)
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
test_kwonly_args
(
a
,
b
):
"""
>>> test_kwonly_args(1, 2)
(1, 2, 123)
"""
def
inner
(
a
,
b
=
b
,
*
,
c
=
123
):
return
a
,
b
,
c
return
inner
(
a
)
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
test_kwonly_args_missing
(
a
,
b
):
"""
>>> test_kwonly_args_missing(1, 2)
Traceback (most recent call last):
TypeError: inner() needs keyword-only argument c
"""
def
inner
(
a
,
b
=
b
,
*
,
c
):
return
a
,
b
,
c
return
inner
(
a
)
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
test_starred
(
a
):
def
test_starred
(
a
):
"""
"""
...
...
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