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
Kirill Smelkov
cython
Commits
a0b45f26
Commit
a0b45f26
authored
May 18, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename type imports of 'unicode' and 'str' type according to Py version
parent
7f55c7d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+18
-5
No files found.
Cython/Compiler/ModuleNode.py
View file @
a0b45f26
...
...
@@ -1668,6 +1668,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
use_utility_code
(
Nodes
.
get_vtable_utility_code
)
env
.
types_imported
[
type
]
=
1
py3_type_name_map
=
{
'str'
:
'bytes'
,
'unicode'
:
'str'
}
def
generate_type_import_call
(
self
,
type
,
code
,
error_code
):
if
type
.
typedef_flag
:
objstruct
=
type
.
objstruct_cname
...
...
@@ -1678,12 +1680,23 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
module_name
=
'"%s"'
%
module_name
else
:
module_name
=
'__Pyx_BUILTIN_MODULE_NAME'
if
type
.
name
in
self
.
py3_type_name_map
:
code
.
putln
(
"#if PY_MAJOR_VERSION >= 3"
)
code
.
putln
(
'%s = __Pyx_ImportType(%s, "%s", sizeof(%s)); %s'
%
(
type
.
typeptr_cname
,
module_name
,
self
.
py3_type_name_map
[
type
.
name
],
objstruct
,
error_code
))
code
.
putln
(
"#else"
)
code
.
putln
(
'%s = __Pyx_ImportType(%s, "%s", sizeof(%s)); %s'
%
(
type
.
typeptr_cname
,
module_name
,
type
.
name
,
objstruct
,
error_code
))
type
.
typeptr_cname
,
module_name
,
type
.
name
,
objstruct
,
error_code
))
if
type
.
name
in
self
.
py3_type_name_map
:
code
.
putln
(
"#endif"
)
def
generate_type_ready_code
(
self
,
env
,
entry
,
code
):
# Generate a call to PyType_Ready for an extension
...
...
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