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
d40225f6
Commit
d40225f6
authored
Jan 23, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate trivial *args splitting code into function body
parent
100eec06
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+19
-11
No files found.
Cython/Compiler/Nodes.py
View file @
d40225f6
...
...
@@ -1348,13 +1348,21 @@ class DefNode(FuncDefNode):
error_return
=
"return %s;"
%
self
.
error_value
()
if
self
.
star_arg
:
star_arg_addr
=
self
.
arg_address
(
self
.
star_arg
)
star_arg_cname
=
self
.
star_arg
.
entry
.
cname
code
.
putln
(
"if (PyTuple_GET_SIZE(%s) <= %d) {"
%
(
Naming
.
args_cname
,
nargs
))
code
.
put_incref
(
Naming
.
args_cname
,
py_object_type
)
code
.
put
(
"%s = %s;"
%
(
star_arg_cname
,
Naming
.
empty_tuple
))
code
.
put_incref
(
Naming
.
empty_tuple
,
py_object_type
)
code
.
putln
(
"}"
)
code
.
putln
(
"else {"
)
code
.
putln
(
"if (unlikely(__Pyx_
GetStarArg(&%s, %s,
%s) < 0)) return %s;"
%
(
"if (unlikely(__Pyx_
SplitStarArg(&%s, %d, &
%s) < 0)) return %s;"
%
(
Naming
.
args_cname
,
nargs
,
star_arg_
addr
,
star_arg_
cname
,
self
.
error_value
()))
code
.
putln
(
"}"
)
self
.
star_arg
.
entry
.
xdecref_cleanup
=
0
elif
self
.
entry
.
signature
.
has_generic_args
:
# make sure supernumerous positional arguments do not run
...
...
@@ -1372,10 +1380,10 @@ class DefNode(FuncDefNode):
if
self
.
starstar_arg
:
handle_error
=
1
code
.
put
(
"if (unlikely(__Pyx_SplitKeywords(&%s, %s, %s, %s) < 0)) "
%
(
"if (unlikely(__Pyx_SplitKeywords(&%s, %s,
&
%s, %s) < 0)) "
%
(
Naming
.
kwds_cname
,
Naming
.
kwdlist_cname
,
self
.
arg_address
(
self
.
starstar_arg
)
,
self
.
starstar_arg
.
entry
.
cname
,
self
.
reqd_kw_flags_cname
))
self
.
starstar_arg
.
entry
.
xdecref_cleanup
=
0
elif
self
.
num_required_kw_args
:
...
...
@@ -3432,7 +3440,7 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
#------------------------------------------------------------------------------------
#
# __Pyx_
Ge
tStarArg splits the args tuple into two parts, one part
# __Pyx_
Spli
tStarArg splits the args tuple into two parts, one part
# suitable for passing to PyArg_ParseTupleAndKeywords, and the other
# containing any extra arguments. On success, replaces the borrowed
# reference *args with references to a new tuple, and passes back a
...
...
@@ -3441,19 +3449,19 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed
get_stararg_utility_code
=
[
"""
static
INLINE int __Pyx_Ge
tStarArg(PyObject **args, Py_ssize_t nargs, PyObject **args2); /*proto*/
static
int __Pyx_Spli
tStarArg(PyObject **args, Py_ssize_t nargs, PyObject **args2); /*proto*/
"""
,
"""
static
INLINE int __Pyx_Ge
tStarArg(
static
int __Pyx_Spli
tStarArg(
PyObject **args,
Py_ssize_t nargs,
PyObject **args2)
{
PyObject *args1 = 0;
*args2 = 0;
args1 = PyTuple_GetSlice(*args, 0, nargs);
if (!args1)
if (!args1) {
*args2 = 0;
return -1;
}
*args2 = PyTuple_GetSlice(*args, nargs, PyTuple_GET_SIZE(*args));
if (!*args2) {
Py_DECREF(args1);
...
...
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