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
8371e5da
Commit
8371e5da
authored
Aug 21, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__cmp__() is dead in Py3, ep+lt should be enough though
parent
0fba6e92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+23
-10
No files found.
Cython/Compiler/PyrexTypes.py
View file @
8371e5da
...
...
@@ -736,11 +736,19 @@ class CComplexType(CNumericType):
self
.
binops
=
{}
self
.
from_parts
=
"%s_from_parts"
%
self
.
specalization_name
()
def
__
cmp
__
(
self
,
other
):
def
__
eq
__
(
self
,
other
):
if
isinstance
(
self
,
CComplexType
)
and
isinstance
(
other
,
CComplexType
):
return
cmp
(
self
.
real_type
,
other
.
real_type
)
return
self
.
real_type
==
other
.
real_type
else
:
return
1
return
False
def
__lt__
(
self
,
other
):
if
isinstance
(
self
,
CComplexType
)
and
isinstance
(
other
,
CComplexType
):
return
self
.
real_type
<
other
.
real_type
else
:
# this is arbitrary, but it makes sure we always have
# *some* kind of order
return
False
def
__hash__
(
self
):
return
~
hash
(
self
.
real_type
)
...
...
@@ -1348,14 +1356,19 @@ class CStructOrUnionType(CType):
base
=
"%s %s"
%
(
self
.
kind
,
self
.
cname
)
return
self
.
base_declaration_code
(
public_decl
(
base
,
dll_linkage
),
entity_code
)
def
__
cmp
__
(
self
,
other
):
def
__
eq
__
(
self
,
other
):
try
:
if
self
.
name
==
other
.
name
:
return
0
else
:
return
1
return
self
.
name
==
other
.
name
except
AttributeError
:
return
1
return
False
def
__lt__
(
self
,
other
):
try
:
return
self
.
name
<
other
.
name
except
AttributeError
:
# this is arbitrary, but it makes sure we always have
# *some* kind of order
return
False
def
is_complete
(
self
):
return
self
.
scope
is
not
None
...
...
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