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
65b33dfb
Commit
65b33dfb
authored
Sep 27, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor C code simplification in argument unpacking code
parent
a9072286
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-6
No files found.
Cython/Compiler/Nodes.py
View file @
65b33dfb
...
...
@@ -2810,8 +2810,9 @@ class DefNode(FuncDefNode):
has_fixed_positional_count
,
has_kw_only_args
,
all_args
,
argtuple_error_label
,
code
):
code
.
putln
(
'Py_ssize_t kw_args;'
)
code
.
putln
(
'const Py_ssize_t pos_args = PyTuple_GET_SIZE(%s);'
%
Naming
.
args_cname
)
# copy the values from the args tuple and check that it's not too long
code
.
putln
(
'switch (
PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
code
.
putln
(
'switch (
pos_args) {'
)
if
self
.
star_arg
:
code
.
putln
(
'default:'
)
for
i
in
range
(
max_positional_args
-
1
,
-
1
,
-
1
):
...
...
@@ -2843,7 +2844,7 @@ class DefNode(FuncDefNode):
last_required_arg
=
max_positional_args
-
1
num_required_args
=
self
.
num_required_args
if
max_positional_args
>
0
:
code
.
putln
(
'switch (
PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
code
.
putln
(
'switch (
pos_args) {'
)
for
i
,
arg
in
enumerate
(
all_args
[:
last_required_arg
+
1
]):
if
max_positional_args
>
0
and
i
<=
max_positional_args
:
if
self
.
star_arg
and
i
==
max_positional_args
:
...
...
@@ -2924,12 +2925,11 @@ class DefNode(FuncDefNode):
if
max_positional_args
==
0
:
pos_arg_count
=
"0"
elif
self
.
star_arg
:
code
.
putln
(
"const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(%s) < %d) ? PyTuple_GET_SIZE(%s) : %d;"
%
(
Naming
.
args_cname
,
max_positional_args
,
Naming
.
args_cname
,
max_positional_args
))
code
.
putln
(
"const Py_ssize_t used_pos_args = (pos_args < %d) ? pos_args : %d;"
%
(
max_positional_args
,
max_positional_args
))
pos_arg_count
=
"used_pos_args"
else
:
pos_arg_count
=
"
PyTuple_GET_SIZE(%s)"
%
Naming
.
args_cname
pos_arg_count
=
"
pos_args"
code
.
globalstate
.
use_utility_code
(
parse_keywords_utility_code
)
code
.
put
(
'if (unlikely(__Pyx_ParseOptionalKeywords(%s, %s, %s, values, %s, "%s") < 0)) '
%
(
...
...
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