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
0b25d4b9
Commit
0b25d4b9
authored
Mar 09, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle sequence in DelStatNode, see #668
parent
16370195
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+15
-4
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+1
-1
tests/run/delete.pyx
tests/run/delete.pyx
+9
-0
No files found.
Cython/Compiler/Nodes.py
View file @
0b25d4b9
...
...
@@ -3785,12 +3785,23 @@ class DelStatNode(StatNode):
child_attrs
=
[
"args"
]
def
flatten_args
(
self
):
return
self
.
_flatten_args
(
self
,
[])
def
_flatten_args
(
self
,
seq
,
result
):
for
arg
in
seq
.
args
:
if
arg
.
is_sequence_constructor
:
self
.
_flatten_args
(
arg
,
result
)
else
:
result
.
append
(
arg
)
return
result
def
analyse_declarations
(
self
,
env
):
for
arg
in
self
.
args
:
for
arg
in
self
.
flatten_args
()
:
arg
.
analyse_target_declaration
(
env
)
def
analyse_expressions
(
self
,
env
):
for
arg
in
self
.
args
:
for
arg
in
self
.
flatten_args
()
:
arg
.
analyse_target_expression
(
env
,
None
)
if
arg
.
type
.
is_pyobject
:
pass
...
...
@@ -3803,14 +3814,14 @@ class DelStatNode(StatNode):
#arg.release_target_temp(env)
def
nogil_check
(
self
,
env
):
for
arg
in
self
.
args
:
for
arg
in
self
.
flatten_args
()
:
if
arg
.
type
.
is_pyobject
:
self
.
gil_error
()
gil_message
=
"Deleting Python object"
def
generate_execution_code
(
self
,
code
):
for
arg
in
self
.
args
:
for
arg
in
self
.
flatten_args
()
:
if
arg
.
type
.
is_pyobject
:
arg
.
generate_deletion_code
(
code
)
elif
arg
.
type
.
is_ptr
and
arg
.
type
.
base_type
.
is_cpp_class
:
...
...
Cython/Compiler/TypeInference.py
View file @
0b25d4b9
...
...
@@ -122,7 +122,7 @@ class MarkAssignments(CythonTransform):
return
node
def
visit_DelStatNode
(
self
,
node
):
for
arg
in
node
.
args
:
for
arg
in
node
.
flatten_args
()
:
self
.
mark_assignment
(
arg
,
arg
)
self
.
visitchildren
(
node
)
return
node
...
...
tests/run/delete.pyx
View file @
0b25d4b9
...
...
@@ -87,3 +87,12 @@ def del_local(a):
"""
del
a
assert
a
is
None
# Until we have unbound locals...
def
del_seq
(
a
,
b
,
c
):
"""
>>> del_seq(1, 2, 3)
"""
del
a
,
(
b
,
c
)
assert
a
is
None
# Until we have unbound locals...
assert
b
is
None
# Until we have unbound locals...
assert
c
is
None
# Until we have unbound locals...
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