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
Xavier Thompson
cython
Commits
595ccb23
Commit
595ccb23
authored
May 22, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reformat dict unpacking code to show the two alternative branches at the same indentation level
parent
b4f8fd7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+18
-16
No files found.
Cython/Compiler/ExprNodes.py
View file @
595ccb23
...
@@ -5589,6 +5589,7 @@ class MergedDictNode(ExprNode):
...
@@ -5589,6 +5589,7 @@ class MergedDictNode(ExprNode):
helpers
=
set
()
helpers
=
set
()
for
item
in
args
:
for
item
in
args
:
if
item
.
is_dict_literal
:
if
item
.
is_dict_literal
:
# inline update instead of creating an intermediate dict
for
arg
in
item
.
key_value_pairs
:
for
arg
in
item
.
key_value_pairs
:
arg
.
generate_evaluation_code
(
code
)
arg
.
generate_evaluation_code
(
code
)
if
self
.
reject_duplicates
:
if
self
.
reject_duplicates
:
...
@@ -5607,23 +5608,24 @@ class MergedDictNode(ExprNode):
...
@@ -5607,23 +5608,24 @@ class MergedDictNode(ExprNode):
arg
.
value
.
py_result
()))
arg
.
value
.
py_result
()))
arg
.
generate_disposal_code
(
code
)
arg
.
generate_disposal_code
(
code
)
arg
.
free_temps
(
code
)
arg
.
free_temps
(
code
)
continue
item
.
generate_evaluation_code
(
code
)
if
self
.
reject_duplicates
:
# merge mapping into kwdict one by one as we need to check for duplicates
helpers
.
add
(
"MergeKeywords"
)
code
.
put_error_if_neg
(
item
.
pos
,
"__Pyx_MergeKeywords(%s, %s)"
%
(
self
.
result
(),
item
.
py_result
()))
else
:
else
:
# simple case, just add all entries
item
.
generate_evaluation_code
(
code
)
helpers
.
add
(
"RaiseMappingExpected"
)
if
self
.
reject_duplicates
:
code
.
putln
(
"if (unlikely(PyDict_Update(%s, %s) < 0)) {"
%
(
self
.
result
(),
item
.
py_result
()))
# merge mapping into kwdict one by one as we need to check for duplicates
code
.
putln
(
"if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseMappingExpectedError(%s);"
%
(
helpers
.
add
(
"MergeKeywords"
)
item
.
py_result
()))
code
.
put_error_if_neg
(
item
.
pos
,
"__Pyx_MergeKeywords(%s, %s)"
%
(
code
.
putln
(
code
.
error_goto
(
item
.
pos
))
self
.
result
(),
item
.
py_result
()))
code
.
putln
(
"}"
)
else
:
item
.
generate_disposal_code
(
code
)
# simple case, just add all entries
item
.
free_temps
(
code
)
helpers
.
add
(
"RaiseMappingExpected"
)
code
.
putln
(
"if (unlikely(PyDict_Update(%s, %s) < 0)) {"
%
(
self
.
result
(),
item
.
py_result
()))
code
.
putln
(
"if (PyErr_ExceptionMatches(PyExc_AttributeError)) "
"__Pyx_RaiseMappingExpectedError(%s);"
%
item
.
py_result
())
code
.
putln
(
code
.
error_goto
(
item
.
pos
))
code
.
putln
(
"}"
)
item
.
generate_disposal_code
(
code
)
item
.
free_temps
(
code
)
for
helper
in
sorted
(
helpers
):
for
helper
in
sorted
(
helpers
):
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
helper
,
"FunctionArguments.c"
))
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
helper
,
"FunctionArguments.c"
))
...
...
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