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
Kirill Smelkov
cython
Commits
b692ef71
Commit
b692ef71
authored
Dec 26, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code simplification
parent
1d0b3e33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+12
-12
No files found.
Cython/Compiler/Nodes.py
View file @
b692ef71
...
...
@@ -2126,9 +2126,10 @@ class DefNode(FuncDefNode):
for
i
,
arg
in
enumerate
(
all_args
):
if
not
arg
.
default
:
last_required_arg
=
i
code
.
putln
(
'switch (PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
if
max_positional_args
>
0
:
code
.
putln
(
'switch (PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
for
i
,
arg
in
enumerate
(
all_args
[:
last_required_arg
+
1
]):
if
i
<=
max_positional_args
:
if
max_positional_args
>
0
and
i
<=
max_positional_args
:
if
self
.
star_arg
and
i
==
max_positional_args
:
code
.
putln
(
'default:'
)
else
:
...
...
@@ -2138,8 +2139,8 @@ class DefNode(FuncDefNode):
continue
code
.
putln
(
'values[%d] = PyDict_GetItem(%s, %s);'
%
(
i
,
Naming
.
kwds_cname
,
arg
.
name_entry
.
pystring_cname
))
code
.
putln
(
'if (likely(values[%d])) kw_args--;'
%
i
);
if
i
<
min_positional_args
:
code
.
putln
(
'if (likely(values[%d])) kw_args--;'
%
i
);
if
i
==
0
:
# special case: we know arg 0 is missing
code
.
put
(
'else '
)
...
...
@@ -2154,15 +2155,14 @@ class DefNode(FuncDefNode):
min_positional_args
,
max_positional_args
,
i
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
'}'
)
else
:
code
.
putln
(
'if (values[%d]) kw_args--;'
%
i
);
if
arg
.
kw_only
and
not
arg
.
default
:
code
.
putln
(
'else {'
)
code
.
put
(
'__Pyx_RaiseKeywordRequired("%s", %s); '
%
(
self
.
name
.
utf8encode
(),
arg
.
name_entry
.
pystring_cname
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
elif
arg
.
kw_only
:
code
.
putln
(
'else {'
)
code
.
put
(
'__Pyx_RaiseKeywordRequired("%s", %s); '
%
(
self
.
name
.
utf8encode
(),
arg
.
name_entry
.
pystring_cname
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
'}'
)
if
max_positional_args
>
0
:
code
.
putln
(
'}'
)
code
.
putln
(
'if (unlikely(kw_args > 0)) {'
)
# non-positional kw args left in dict: default args, **kwargs or error
...
...
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