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
Boxiang Sun
cython
Commits
51e3a151
Commit
51e3a151
authored
Nov 11, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace literal None check by a NoneCheckNode
parent
a3cb7aa5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-8
No files found.
Cython/Compiler/ExprNodes.py
View file @
51e3a151
...
...
@@ -6204,12 +6204,6 @@ class CmpNode(object):
if
op
==
'not_in'
:
negation
=
"__Pyx_NegateNonNeg"
if
operand2
.
type
is
dict_type
:
code
.
globalstate
.
use_utility_code
(
raise_none_iter_error_utility_code
)
code
.
putln
(
"if (unlikely(%s == Py_None)) {"
%
operand2
.
py_result
())
code
.
putln
(
"__Pyx_RaiseNoneNotIterableError(); %s"
%
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"} else {"
)
method
=
"PyDict_Contains"
else
:
method
=
"PySequence_Contains"
...
...
@@ -6229,8 +6223,6 @@ class CmpNode(object):
operand1
.
py_result
(),
got_ref
,
error_clause
(
result_code
,
self
.
pos
)))
if
operand2
.
type
is
dict_type
:
code
.
putln
(
"}"
)
elif
(
operand1
.
type
.
is_pyobject
and
op
not
in
(
'is'
,
'is_not'
)):
code
.
putln
(
"%s = PyObject_RichCompare(%s, %s, %s); %s"
%
(
...
...
@@ -6427,6 +6419,8 @@ class PrimaryCmpNode(ExprNode, CmpNode):
# Will be transformed by IterationTransform
return
else
:
if
self
.
operand2
.
type
is
dict_type
:
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
common_type
=
py_object_type
self
.
is_pycmp
=
True
elif
self
.
find_special_bool_compare_function
(
env
):
...
...
@@ -6588,6 +6582,8 @@ class CascadedCmpNode(Node, CmpNode):
def
coerce_operands_to_pyobjects
(
self
,
env
):
self
.
operand2
=
self
.
operand2
.
coerce_to_pyobject
(
env
)
if
self
.
operand2
.
type
is
dict_type
and
self
.
operator
in
(
'in'
,
'not_in'
):
self
.
operand2
=
self
.
operand2
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
if
self
.
cascade
:
self
.
cascade
.
coerce_operands_to_pyobjects
(
env
)
...
...
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