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
2e864668
Commit
2e864668
authored
Oct 21, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More comparison fixes.
parent
3c0c4d06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-8
tests/run/cmp.pyx
tests/run/cmp.pyx
+8
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
2e864668
...
@@ -5134,23 +5134,19 @@ class CmpNode(object):
...
@@ -5134,23 +5134,19 @@ class CmpNode(object):
# fall back to generic type compatibility tests
# fall back to generic type compatibility tests
if
type1
==
type2
:
if
type1
==
type2
:
new_common_type
=
type1
new_common_type
=
type1
elif
not
type2
is
py_object_type
and
type1
.
assignable_from
(
type2
):
new_common_type
=
type1
elif
not
type1
is
py_object_type
and
type2
.
assignable_from
(
type1
):
new_common_type
=
type2
elif
type1
.
is_pyobject
and
type2
.
is_pyobject
:
new_common_type
=
py_object_type
elif
type1
.
is_pyobject
or
type2
.
is_pyobject
:
elif
type1
.
is_pyobject
or
type2
.
is_pyobject
:
if
type2
.
is_numeric
or
type2
.
is_string
:
if
type2
.
is_numeric
or
type2
.
is_string
:
if
operand2
.
check_for_coercion_error
(
type1
):
if
operand2
.
check_for_coercion_error
(
type1
):
new_common_type
=
error_type
new_common_type
=
error_type
else
:
else
:
new_common_type
=
type1
new_common_type
=
py_object_type
elif
type1
.
is_numeric
or
type1
.
is_string
:
elif
type1
.
is_numeric
or
type1
.
is_string
:
if
operand1
.
check_for_coercion_error
(
type2
):
if
operand1
.
check_for_coercion_error
(
type2
):
new_common_type
=
error_type
new_common_type
=
error_type
else
:
else
:
new_common_type
=
type2
new_common_type
=
py_object_type
elif
py_object_type
.
assignable_from
(
type1
)
and
py_object_type
.
assignable_from
(
type2
):
new_common_type
=
py_object_type
else
:
else
:
# one Python type and one non-Python type, not assignable
# one Python type and one non-Python type, not assignable
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
...
...
tests/run/cmp.pyx
View file @
2e864668
...
@@ -37,6 +37,12 @@ def cascaded_c(double a, double b, double c):
...
@@ -37,6 +37,12 @@ def cascaded_c(double a, double b, double c):
def
typed_cmp
(
list
L
):
def
typed_cmp
(
list
L
):
"""
"""
>>> typed_cmp([1,2,3])
>>> typed_cmp([1,2,3])
(False, False)
False
False
False
False
"""
"""
return
L
is
Ellipsis
,
Ellipsis
is
L
print
L
is
Ellipsis
print
Ellipsis
is
L
print
1
==
L
print
L
==
1.5
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