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
ac871a9e
Commit
ac871a9e
authored
Feb 05, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error handling fixes for argument unpacking when args/kwargs are in closures
parent
8a5ebb6c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-5
tests/run/args_unpacking_in_closure_T658.pyx
tests/run/args_unpacking_in_closure_T658.pyx
+14
-0
No files found.
Cython/Compiler/Nodes.py
View file @
ac871a9e
...
...
@@ -2387,9 +2387,9 @@ class DefNode(FuncDefNode):
self
.
generate_arg_decref
(
self
.
star_arg
,
code
)
if
self
.
starstar_arg
:
if
self
.
starstar_arg
.
entry
.
xdecref_cleanup
:
code
.
put_var_xdecref
(
self
.
starstar_arg
.
entry
)
code
.
put_var_xdecref
_clear
(
self
.
starstar_arg
.
entry
)
else
:
code
.
put_var_decref
(
self
.
starstar_arg
.
entry
)
code
.
put_var_decref
_clear
(
self
.
starstar_arg
.
entry
)
code
.
putln
(
'__Pyx_AddTraceback("%s");'
%
self
.
entry
.
qualified_name
)
# The arguments are put into the closure one after the
# other, so when type errors are found, all references in
...
...
@@ -2429,11 +2429,11 @@ class DefNode(FuncDefNode):
def
generate_arg_xdecref
(
self
,
arg
,
code
):
if
arg
:
code
.
put_var_xdecref
(
arg
.
entry
)
code
.
put_var_xdecref
_clear
(
arg
.
entry
)
def
generate_arg_decref
(
self
,
arg
,
code
):
if
arg
:
code
.
put_var_decref
(
arg
.
entry
)
code
.
put_var_decref
_clear
(
arg
.
entry
)
def
generate_stararg_copy_code
(
self
,
code
):
if
not
self
.
star_arg
:
...
...
@@ -2641,7 +2641,7 @@ class DefNode(FuncDefNode):
if
self
.
starstar_arg
:
code
.
putln
(
""
)
code
.
putln
(
"if (unlikely(!%s)) {"
%
self
.
star_arg
.
entry
.
cname
)
code
.
put_decref
(
self
.
starstar_arg
.
entry
.
cname
,
py_object_type
)
code
.
put_decref
_clear
(
self
.
starstar_arg
.
entry
.
cname
,
py_object_type
)
code
.
putln
(
'return %s;'
%
self
.
error_value
())
code
.
putln
(
'}'
)
else
:
...
...
tests/run/args_unpacking_in_closure_T658.pyx
0 → 100644
View file @
ac871a9e
def
outer
(
int
x
,
*
args
,
**
kwargs
):
"""
>>> inner = outer(1, 2, a=3)
>>> inner()
(1, (2,), {'a': 3})
>>> inner = outer('abc', 2, a=3)
Traceback (most recent call last):
TypeError: an integer is required
"""
def
inner
():
return
x
,
args
,
kwargs
return
inner
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