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
Boxiang Sun
cython
Commits
55b5ae9e
Commit
55b5ae9e
authored
Apr 29, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate subexpression code for deletion of C++ classes.
parent
e1e33240
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-1
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+15
-0
No files found.
Cython/Compiler/Nodes.py
View file @
55b5ae9e
...
...
@@ -5452,8 +5452,9 @@ class DelStatNode(StatNode):
arg
.
generate_deletion_code
(
code
,
ignore_nonexisting
=
self
.
ignore_nonexisting
)
elif
arg
.
type
.
is_ptr
and
arg
.
type
.
base_type
.
is_cpp_class
:
arg
.
generate_
result
_code
(
code
)
arg
.
generate_
evaluation
_code
(
code
)
code
.
putln
(
"delete %s;"
%
arg
.
result
())
arg
.
generate_disposal_code
(
code
)
# else error reported earlier
def
annotate
(
self
,
code
):
...
...
tests/run/cpp_classes.pyx
View file @
55b5ae9e
...
...
@@ -179,3 +179,18 @@ def test_template_class_member():
del
o
assert
destructor_count
-
start_destructor_count
==
2
,
\
destructor_count
-
start_destructor_count
ctypedef
vector
[
int
]
*
vector_int_ptr
cdef
vector
[
vector_int_ptr
]
create_to_delete
()
except
*
:
cdef
vector
[
vector_int_ptr
]
v
v
.
push_back
(
new
vector
[
int
]())
return
v
cdef
int
f
(
int
x
):
return
x
def
test_nested_del
():
cdef
vector
[
vector_int_ptr
]
v
v
.
push_back
(
new
vector
[
int
]())
del
v
[
0
]
del
create_to_delete
()[
f
(
f
(
0
))]
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