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
7e039fc9
Commit
7e039fc9
authored
Aug 07, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid redundant code in tp_dealloc() and friends when inheriting from builtin types
parent
5b8f2452
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+10
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
7e039fc9
...
...
@@ -1114,6 +1114,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
tp_dealloc
=
TypeSlots
.
get_base_slot_function
(
scope
,
tp_slot
)
if
tp_dealloc
is
not
None
:
code
.
putln
(
"%s(o);"
%
tp_dealloc
)
elif
base_type
.
is_builtin_type
:
code
.
putln
(
"%s->tp_dealloc(o);"
%
base_type
.
typeptr_cname
)
else
:
# This is an externally defined type. Calling through the
# cimported base type pointer directly interacts badly with
...
...
@@ -1178,6 +1180,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
static_call
=
TypeSlots
.
get_base_slot_function
(
scope
,
tp_slot
)
if
static_call
:
code
.
putln
(
"e = %s(o, v, a); if (e) return e;"
%
static_call
)
elif
base_type
.
is_builtin_type
:
base_cname
=
base_type
.
typeptr_cname
code
.
putln
(
"if (!%s->tp_traverse); else { e = %s->tp_traverse(o,v,a); if (e) return e; }"
%
(
base_cname
,
base_cname
))
else
:
# This is an externally defined type. Calling through the
# cimported base type pointer directly interacts badly with
...
...
@@ -1243,6 +1249,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
static_call
=
TypeSlots
.
get_base_slot_function
(
scope
,
tp_slot
)
if
static_call
:
code
.
putln
(
"%s(o);"
%
static_call
)
elif
base_type
.
is_builtin_type
:
base_cname
=
base_type
.
typeptr_cname
code
.
putln
(
"if (!%s->tp_clear); else %s->tp_clear(o);"
%
(
base_cname
,
base_cname
))
else
:
# This is an externally defined type. Calling through the
# cimported base type pointer directly interacts badly with
...
...
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