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
e9db1e9a
Commit
e9db1e9a
authored
May 04, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent redundant type checks when 'converting' between str and bytes type
parent
cdfded6a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+9
-1
No files found.
Cython/Compiler/PyrexTypes.py
View file @
e9db1e9a
...
@@ -274,8 +274,14 @@ class BuiltinObjectType(PyObjectType):
...
@@ -274,8 +274,14 @@ class BuiltinObjectType(PyObjectType):
base_type
=
None
base_type
=
None
module_name
=
'__builtin__'
module_name
=
'__builtin__'
alternative_name
=
None
# used for str/bytes duality
def
__init__
(
self
,
name
,
cname
):
def
__init__
(
self
,
name
,
cname
):
self
.
name
=
name
self
.
name
=
name
if
name
==
'str'
:
self
.
alternative_name
=
'bytes'
elif
name
==
'bytes'
:
self
.
alternative_name
=
'str'
self
.
cname
=
cname
self
.
cname
=
cname
self
.
typeptr_cname
=
"&"
+
cname
self
.
typeptr_cname
=
"&"
+
cname
...
@@ -292,7 +298,9 @@ class BuiltinObjectType(PyObjectType):
...
@@ -292,7 +298,9 @@ class BuiltinObjectType(PyObjectType):
def
assignable_from
(
self
,
src_type
):
def
assignable_from
(
self
,
src_type
):
if
isinstance
(
src_type
,
BuiltinObjectType
):
if
isinstance
(
src_type
,
BuiltinObjectType
):
return
src_type
.
name
==
self
.
name
return
src_type
.
name
==
self
.
name
or
(
src_type
.
name
==
self
.
alternative_name
and
src_type
.
name
is
not
None
)
else
:
else
:
return
not
src_type
.
is_extension_type
return
not
src_type
.
is_extension_type
...
...
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