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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
12be176b
Commit
12be176b
authored
Oct 03, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix python 3 deepcopy & sorting compatiblity
parent
4dd15777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+6
-2
Cython/Compiler/StringEncoding.py
Cython/Compiler/StringEncoding.py
+6
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
12be176b
...
...
@@ -68,8 +68,11 @@ class BaseType(object):
"""
For sorting. The sorting order should correspond to the preference of
conversion from Python types.
Override to provide something sensible. This is only implemented so that
python 3 doesn't trip
"""
return
NotImplemented
return
id
(
type
(
self
))
<
id
(
type
(
other
))
def
py_type_name
(
self
):
"""
...
...
@@ -1209,7 +1212,8 @@ class CNumericType(CType):
if
other
.
is_numeric
:
return
self
.
rank
>
other
.
rank
and
self
.
signed
>=
other
.
signed
return
NotImplemented
# Prefer numeric types over others
return
True
def
py_type_name
(
self
):
if
self
.
rank
<=
4
:
...
...
Cython/Compiler/StringEncoding.py
View file @
12be176b
...
...
@@ -115,6 +115,9 @@ class EncodedString(_unicode):
# otherwise
encoding
=
None
def
__deepcopy__
(
self
,
memo
):
return
self
def
byteencode
(
self
):
assert
self
.
encoding
is
not
None
return
self
.
encode
(
self
.
encoding
)
...
...
@@ -131,6 +134,9 @@ class BytesLiteral(_bytes):
# bytes subclass that is compatible with EncodedString
encoding
=
None
def
__deepcopy__
(
self
,
memo
):
return
self
def
byteencode
(
self
):
if
IS_PYTHON3
:
return
_bytes
(
self
)
...
...
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