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
558f4ef1
Commit
558f4ef1
authored
Jul 23, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 'type' adaptation code to work with PyPy
parent
ea539d24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
18 deletions
+33
-18
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+33
-18
No files found.
Cython/Compiler/ModuleNode.py
View file @
558f4ef1
...
@@ -2187,10 +2187,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2187,10 +2187,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
objstruct
=
type
.
objstruct_cname
objstruct
=
type
.
objstruct_cname
else
:
else
:
objstruct
=
"struct %s"
%
type
.
objstruct_cname
objstruct
=
"struct %s"
%
type
.
objstruct_cname
# Some builtin types have a tp_basicsize which differs from sizeof(...):
sizeof_objstruct
=
objstruct
objstruct
=
Code
.
basicsize_builtins_map
.
get
(
objstruct
,
objstruct
)
module_name
=
type
.
module_name
module_name
=
type
.
module_name
condition
=
None
condition
=
replacement
=
None
if
module_name
not
in
(
'__builtin__'
,
'builtins'
):
if
module_name
not
in
(
'__builtin__'
,
'builtins'
):
module_name
=
'"%s"'
%
module_name
module_name
=
'"%s"'
%
module_name
else
:
else
:
...
@@ -2198,22 +2197,38 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2198,22 +2197,38 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
type
.
name
in
Code
.
non_portable_builtins_map
:
if
type
.
name
in
Code
.
non_portable_builtins_map
:
condition
,
replacement
=
Code
.
non_portable_builtins_map
[
type
.
name
]
condition
,
replacement
=
Code
.
non_portable_builtins_map
[
type
.
name
]
code
.
putln
(
"#if %s"
%
condition
)
code
.
putln
(
"#if %s"
%
condition
)
code
.
putln
(
'%s = __Pyx_ImportType(%s, "%s", sizeof(%s), 1); %s'
%
(
if
objstruct
in
Code
.
basicsize_builtins_map
:
type
.
typeptr_cname
,
# Some builtin types have a tp_basicsize which differs from sizeof(...):
module_name
,
sizeof_objstruct
=
Code
.
basicsize_builtins_map
[
objstruct
]
replacement
,
objstruct
,
code
.
put
(
'%s = __Pyx_ImportType(%s,'
%
(
error_code
))
type
.
typeptr_cname
,
code
.
putln
(
"#else"
)
module_name
))
code
.
putln
(
'%s = __Pyx_ImportType(%s, "%s", sizeof(%s), %i); %s'
%
(
type
.
typeptr_cname
,
if
condition
and
replacement
:
module_name
,
code
.
putln
(
""
)
# start in new line
type
.
name
,
code
.
putln
(
"#if %s"
%
condition
)
objstruct
,
code
.
putln
(
'"%s",'
%
replacement
)
not
type
.
is_external
or
type
.
is_subclassed
,
code
.
putln
(
"#else"
)
error_code
))
code
.
putln
(
'"%s",'
%
type
.
name
)
if
condition
:
code
.
putln
(
"#endif"
)
else
:
code
.
put
(
' "%s", '
%
type
.
name
)
if
sizeof_objstruct
!=
objstruct
:
if
not
condition
:
code
.
putln
(
""
)
# start in new line
code
.
putln
(
"#if CYTHON_COMPILING_IN_PYPY"
)
code
.
putln
(
'sizeof(%s),'
%
objstruct
)
code
.
putln
(
"#else"
)
code
.
putln
(
'sizeof(%s),'
%
sizeof_objstruct
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
else
:
code
.
put
(
'sizeof(%s), '
%
objstruct
)
code
.
putln
(
'%i); %s'
%
(
not
type
.
is_external
or
type
.
is_subclassed
,
error_code
))
def
generate_type_ready_code
(
self
,
env
,
entry
,
code
):
def
generate_type_ready_code
(
self
,
env
,
entry
,
code
):
# Generate a call to PyType_Ready for an extension
# 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