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
e1ae63dd
Commit
e1ae63dd
authored
Dec 19, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor some code repetition into a loop.
parent
e801d21a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-18
No files found.
Cython/Compiler/ExprNodes.py
View file @
e1ae63dd
...
@@ -12192,27 +12192,22 @@ class CmpNode(object):
...
@@ -12192,27 +12192,22 @@ class CmpNode(object):
self
.
special_bool_cmp_function
=
"__Pyx_PyString_Equals"
self
.
special_bool_cmp_function
=
"__Pyx_PyString_Equals"
return
True
return
True
elif
self
.
operator
in
(
'in'
,
'not_in'
):
elif
self
.
operator
in
(
'in'
,
'not_in'
):
if
self
.
operand2
.
type
is
Builtin
.
dict_type
:
for
type_name
,
special_type
in
[
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
(
'Dict'
,
Builtin
.
dict_type
),
self
.
special_bool_cmp_utility_code
=
UtilityCode
.
load_cached
(
"PyDictContains"
,
"ObjectHandling.c"
)
(
'Set'
,
Builtin
.
set_type
),
self
.
special_bool_cmp_function
=
"__Pyx_PyDict_ContainsTF"
(
'Unicode'
,
Builtin
.
unicode_type
)]:
return
True
if
self
.
operand2
.
type
is
special_type
:
elif
self
.
operand2
.
type
is
Builtin
.
set_type
:
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
break
self
.
special_bool_cmp_utility_code
=
UtilityCode
.
load_cached
(
"PySetContains"
,
"ObjectHandling.c"
)
self
.
special_bool_cmp_function
=
"__Pyx_PySet_ContainsTF"
return
True
elif
self
.
operand2
.
type
is
Builtin
.
unicode_type
:
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
self
.
special_bool_cmp_utility_code
=
UtilityCode
.
load_cached
(
"PyUnicodeContains"
,
"StringTools.c"
)
self
.
special_bool_cmp_function
=
"__Pyx_PyUnicode_ContainsTF"
return
True
else
:
else
:
if
not
self
.
operand2
.
type
.
is_pyobject
:
if
not
self
.
operand2
.
type
.
is_pyobject
:
self
.
operand2
=
self
.
operand2
.
coerce_to_pyobject
(
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to_pyobject
(
env
)
self
.
special_bool_cmp_utility_code
=
UtilityCode
.
load_cached
(
"PySequenceContains"
,
"ObjectHandling.c"
)
type_name
=
'Sequence'
self
.
special_bool_cmp_function
=
"__Pyx_PySequence_ContainsTF"
# map to utility functions PySequenceContains, PySetContains, PyDictContains etc.
return
True
self
.
special_bool_cmp_utility_code
=
UtilityCode
.
load_cached
(
"Py%sContains"
%
type_name
,
"ObjectHandling.c"
)
self
.
special_bool_cmp_function
=
"__Pyx_Py%s_ContainsTF"
%
type_name
return
True
return
False
return
False
def
generate_operation_code
(
self
,
code
,
result_code
,
def
generate_operation_code
(
self
,
code
,
result_code
,
...
...
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