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
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
Show 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):
...
@@ -5229,8 +5229,8 @@ class GeneralCallNode(CallNode):
self
.
compile_time_value_error
(
e
)
self
.
compile_time_value_error
(
e
)
def
explicit_args_kwds
(
self
):
def
explicit_args_kwds
(
self
):
if
(
self
.
keyword_args
and
not
isinstance
(
self
.
keyword_args
,
DictNode
)
or
if
(
self
.
keyword_args
and
not
self
.
keyword_args
.
is_dict_literal
or
not
isinstance
(
self
.
positional_args
,
TupleNode
)
):
not
self
.
positional_args
.
is_sequence_constructor
):
raise
CompileError
(
self
.
pos
,
raise
CompileError
(
self
.
pos
,
'Compile-time keyword arguments must be explicit.'
)
'Compile-time keyword arguments must be explicit.'
)
return
self
.
positional_args
.
args
,
self
.
keyword_args
return
self
.
positional_args
.
args
,
self
.
keyword_args
...
@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode):
...
@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode):
if
not
isinstance
(
self
.
positional_args
,
TupleNode
):
if
not
isinstance
(
self
.
positional_args
,
TupleNode
):
# has starred argument
# has starred argument
return
self
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
# keywords come from arbitrary expression => nothing to do here
return
self
return
self
function
=
self
.
function
function
=
self
.
function
...
@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode):
...
@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode):
code
.
put_gotref
(
self
.
py_result
())
code
.
put_gotref
(
self
.
py_result
())
class
KeywordArgs
Node
(
ExprNode
):
class
MergedDict
Node
(
ExprNode
):
# Helper class for keyword arguments.
# Helper class for keyword arguments
and other merged dicts
.
#
#
# keyword_args [DictNode or other ExprNode]
# keyword_args [DictNode or other ExprNode]
...
...
Cython/Compiler/Nodes.py
View file @
d79afd60
...
@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode):
...
@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode):
else
:
else
:
assert
self
.
metaclass
is
not
None
assert
self
.
metaclass
is
not
None
else
:
else
:
#
KeywordArgs
Node
#
MergedDict
Node
self
.
mkw
=
ExprNodes
.
ProxyNode
(
keyword_args
)
self
.
mkw
=
ExprNodes
.
ProxyNode
(
keyword_args
)
if
force_py3_semantics
or
self
.
bases
or
self
.
mkw
or
self
.
metaclass
:
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):
...
@@ -509,7 +509,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
keyword_dict
=
kwargs
[
0
]
keyword_dict
=
kwargs
[
0
]
else
:
else
:
# at least one **kwargs
# 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
return
arg_tuple
,
keyword_dict
...
...
tests/run/kwargs_passthrough.pyx
View file @
d79afd60
cimport
cython
cimport
cython
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough
(
f
):
def
wrap_passthrough
(
f
):
"""
"""
>>> def f(a=1): return a
>>> def f(a=1): return a
...
@@ -19,7 +19,7 @@ def wrap_passthrough(f):
...
@@ -19,7 +19,7 @@ def wrap_passthrough(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
unused
(
*
args
,
**
kwargs
):
def
unused
(
*
args
,
**
kwargs
):
"""
"""
>>> unused()
>>> unused()
...
@@ -30,7 +30,7 @@ def unused(*args, **kwargs):
...
@@ -30,7 +30,7 @@ def unused(*args, **kwargs):
return
args
return
args
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
used_in_closure
(
**
kwargs
):
def
used_in_closure
(
**
kwargs
):
"""
"""
>>> used_in_closure()
>>> used_in_closure()
...
@@ -44,7 +44,7 @@ def used_in_closure(**kwargs):
...
@@ -44,7 +44,7 @@ def used_in_closure(**kwargs):
return
func
()
return
func
()
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
modify_in_closure
(
**
kwargs
):
def
modify_in_closure
(
**
kwargs
):
"""
"""
>>> func = modify_in_closure()
>>> func = modify_in_closure()
...
@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs):
...
@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs):
return
func
return
func
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough_more
(
f
):
def
wrap_passthrough_more
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -80,7 +80,7 @@ def wrap_passthrough_more(f):
...
@@ -80,7 +80,7 @@ def wrap_passthrough_more(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_passthrough2
(
f
):
def
wrap_passthrough2
(
f
):
"""
"""
>>> def f(a=1): return a
>>> def f(a=1): return a
...
@@ -99,7 +99,7 @@ def wrap_passthrough2(f):
...
@@ -99,7 +99,7 @@ def wrap_passthrough2(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify
(
f
):
def
wrap_modify
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -123,7 +123,7 @@ def wrap_modify(f):
...
@@ -123,7 +123,7 @@ def wrap_modify(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_mix
(
f
):
def
wrap_modify_mix
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -148,7 +148,7 @@ def wrap_modify_mix(f):
...
@@ -148,7 +148,7 @@ def wrap_modify_mix(f):
return
wrapper
return
wrapper
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_func
(
f
):
def
wrap_modify_func
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -175,7 +175,7 @@ def wrap_modify_func(f):
...
@@ -175,7 +175,7 @@ def wrap_modify_func(f):
return
wrapper
return
wrapper
@
cython
.
test_assert_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_assert_path_exists
(
'//
MergedDict
Node'
)
def
wrap_modify_func_mix
(
f
):
def
wrap_modify_func_mix
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f):
...
@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
wrap_reassign
(
f
):
def
wrap_reassign
(
f
):
"""
"""
>>> def f(a=1, test=2):
>>> def f(a=1, test=2):
...
@@ -227,7 +227,7 @@ def wrap_reassign(f):
...
@@ -227,7 +227,7 @@ def wrap_reassign(f):
return
wrapper
return
wrapper
@
cython
.
test_fail_if_path_exists
(
'//
KeywordArgs
Node'
)
@
cython
.
test_fail_if_path_exists
(
'//
MergedDict
Node'
)
def
kwargs_metaclass
(
**
kwargs
):
def
kwargs_metaclass
(
**
kwargs
):
"""
"""
>>> K = kwargs_metaclass()
>>> 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