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
166ffcdb
Commit
166ffcdb
authored
Oct 20, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments
parent
22030517
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
166ffcdb
...
@@ -5105,10 +5105,13 @@ class CmpNode(object):
...
@@ -5105,10 +5105,13 @@ class CmpNode(object):
new_common_type
=
None
new_common_type
=
None
# catch general errors
if
type1
==
str_type
and
(
type2
.
is_string
or
type2
in
(
bytes_type
,
unicode_type
))
or
\
if
type1
==
str_type
and
(
type2
.
is_string
or
type2
in
(
bytes_type
,
unicode_type
))
or
\
type2
==
str_type
and
(
type1
.
is_string
or
type1
in
(
bytes_type
,
unicode_type
)):
type2
==
str_type
and
(
type1
.
is_string
or
type1
in
(
bytes_type
,
unicode_type
)):
error
(
self
.
pos
,
"Comparisons between bytes/unicode and str are not portable to Python 3"
)
error
(
self
.
pos
,
"Comparisons between bytes/unicode and str are not portable to Python 3"
)
new_common_type
=
error_type
new_common_type
=
error_type
# try to use numeric comparisons where possible
elif
type1
.
is_complex
or
type2
.
is_complex
:
elif
type1
.
is_complex
or
type2
.
is_complex
:
if
op
not
in
(
'=='
,
'!='
):
if
op
not
in
(
'=='
,
'!='
):
error
(
self
.
pos
,
"complex types are unordered"
)
error
(
self
.
pos
,
"complex types are unordered"
)
...
@@ -5125,6 +5128,7 @@ class CmpNode(object):
...
@@ -5125,6 +5128,7 @@ class CmpNode(object):
new_common_type
=
self
.
find_common_int_type
(
env
,
op
,
operand1
,
operand2
)
new_common_type
=
self
.
find_common_int_type
(
env
,
op
,
operand1
,
operand2
)
if
new_common_type
is
None
:
if
new_common_type
is
None
:
# fall back to generic type compatibility tests
if
type1
==
type2
or
type1
.
assignable_from
(
type2
):
if
type1
==
type2
or
type1
.
assignable_from
(
type2
):
new_common_type
=
type1
new_common_type
=
type1
elif
type2
.
assignable_from
(
type1
):
elif
type2
.
assignable_from
(
type1
):
...
@@ -5151,6 +5155,7 @@ class CmpNode(object):
...
@@ -5151,6 +5155,7 @@ class CmpNode(object):
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
new_common_type
=
error_type
new_common_type
=
error_type
# recursively merge types
if
common_type
is
None
or
new_common_type
.
is_error
:
if
common_type
is
None
or
new_common_type
.
is_error
:
common_type
=
new_common_type
common_type
=
new_common_type
else
:
else
:
...
...
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