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
9cece7db
Commit
9cece7db
authored
Oct 21, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cmp tests, refix C assignable types.
parent
9f9458c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-0
tests/run/cmp.pyx
tests/run/cmp.pyx
+27
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
9cece7db
...
...
@@ -5151,6 +5151,10 @@ class CmpNode(object):
# one Python type and one non-Python type, not assignable
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
new_common_type
=
error_type
elif
type1
.
assignable_from
(
type2
):
new_common_type
=
type1
elif
type2
.
assignable_from
(
type1
):
new_common_type
=
type2
else
:
# C types that we couldn't handle up to here are an error
self
.
invalid_types_error
(
operand1
,
op
,
operand2
)
...
...
tests/run/cmp.pyx
View file @
9cece7db
...
...
@@ -46,3 +46,30 @@ def typed_cmp(list L):
print
Ellipsis
is
L
print
1
==
L
print
L
==
1.5
def
pointer_cmp
():
"""
>>> pointer_cmp()
True
False
True
"""
cdef
int
*
a
=
NULL
cdef
double
*
b
=
NULL
cdef
double
**
c
=
NULL
print
a
is
NULL
print
b
is
not
NULL
print
c
==
NULL
def
c_cmp
(
double
a
,
int
b
,
long
c
):
"""
>>> c_cmp(1, 2, 3)
True
>>> c_cmp(1.5, 2, 2)
True
>>> c_cmp(1.5, 2, 0)
False
>>> c_cmp(1, 1, 3)
False
"""
return
a
<
b
<=
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