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
d79afd60
Commit
d79afd60
authored
May 13, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename KeywordArgsNode to MergedDictNode to generalise it
parent
cd794dcd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
tests/run/kwargs_passthrough.pyx
tests/run/kwargs_passthrough.pyx
+12
-12
No files found.
Cython/Compiler/ExprNodes.py
View file @
d79afd60
...
...
@@ -5229,8 +5229,8 @@ class GeneralCallNode(CallNode):
self
.
compile_time_value_error
(
e
)
def
explicit_args_kwds
(
self
):
if
(
self
.
keyword_args
and
not
isinstance
(
self
.
keyword_args
,
DictNode
)
or
not
isinstance
(
self
.
positional_args
,
TupleNode
)
):
if
(
self
.
keyword_args
and
not
self
.
keyword_args
.
is_dict_literal
or
not
self
.
positional_args
.
is_sequence_constructor
):
raise
CompileError
(
self
.
pos
,
'Compile-time keyword arguments must be explicit.'
)
return
self
.
positional_args
.
args
,
self
.
keyword_args
...
...
@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode):
if
not
isinstance
(
self
.
positional_args
,
TupleNode
):
# has starred argument
return
self
if
not
isinstance
(
self
.
keyword_args
,
DictNode
)
:
if
not
self
.
keyword_args
.
is_dict_literal
:
# keywords come from arbitrary expression => nothing to do here
return
self
function
=
self
.
function
...
...
@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode):
code
.
put_gotref
(
self
.
py_result
())
class
KeywordArgs
Node
(
ExprNode
):
# Helper class for keyword arguments.
class
MergedDict
Node
(
ExprNode
):
# Helper class for keyword arguments
and other merged dicts
.
#
# keyword_args [DictNode or other ExprNode]
...
...
Cython/Compiler/Nodes.py
View file @
d79afd60
...
...
@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode):
else
:
assert
self
.
metaclass
is
not
None
else
:
#
KeywordArgs
Node
#
MergedDict
Node
self
.
mkw
=
ExprNodes
.
ProxyNode
(
keyword_args
)
if
force_py3_semantics
or
self
.
bases
or
self
.
mkw
or
self
.
metaclass
:
...
...
Cython/Compiler/Parsing.py
View file @
d79afd60
...
...
@@ -509,7 +509,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
keyword_dict
=
kwargs
[
0
]
else
:
# at least one **kwargs
keyword_dict
=
ExprNodes
.
KeywordArgs
Node
(
pos
,
keyword_args
=
kwargs
)
keyword_dict
=
ExprNodes
.
MergedDict
Node
(
pos
,
keyword_args
=
kwargs
)
return
arg_tuple
,
keyword_dict
...
...
tests/run/kwargs_passthrough.pyx
View file @
d79afd60
cimport
cython
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough
(
f
):
"""
>>> def f(a=1): return a
...
...
@@ -19,7 +19,7 @@ def wrap_passthrough(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
unused
(
*
args
,
**
kwargs
):
"""
>>> unused()
...
...
@@ -30,7 +30,7 @@ def unused(*args, **kwargs):
return
args
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
used_in_closure
(
**
kwargs
):
"""
>>> used_in_closure()
...
...
@@ -44,7 +44,7 @@ def used_in_closure(**kwargs):
return
func
()
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
modify_in_closure
(
**
kwargs
):
"""
>>> func = modify_in_closure()
...
...
@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs):
return
func
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough_more
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -80,7 +80,7 @@ def wrap_passthrough_more(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough2
(
f
):
"""
>>> def f(a=1): return a
...
...
@@ -99,7 +99,7 @@ def wrap_passthrough2(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -123,7 +123,7 @@ def wrap_modify(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_mix
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -148,7 +148,7 @@ def wrap_modify_mix(f):
return
wrapper
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_func
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -175,7 +175,7 @@ def wrap_modify_func(f):
return
wrapper
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_func_mix
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_reassign
(
f
):
"""
>>> def f(a=1, test=2):
...
...
@@ -227,7 +227,7 @@ def wrap_reassign(f):
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
kwargs_metaclass
(
**
kwargs
):
"""
>>> K = kwargs_metaclass()
...
...
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