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
69cca645
Commit
69cca645
authored
Feb 11, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete None slices properly
parent
5da409f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Cython/Utility/MemoryView_C.c
Cython/Utility/MemoryView_C.c
+5
-1
tests/run/memslice.pyx
tests/run/memslice.pyx
+17
-0
No files found.
Cython/Utility/MemoryView_C.c
View file @
69cca645
...
@@ -450,8 +450,12 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice,
...
@@ -450,8 +450,12 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice,
int
last_time
;
int
last_time
;
struct
{{
memview_struct_name
}}
*
memview
=
memslice
->
memview
;
struct
{{
memview_struct_name
}}
*
memview
=
memslice
->
memview
;
if
(
!
memview
||
(
PyObject
*
)
memview
==
Py_None
)
if
(
!
memview
)
{
return
;
}
else
if
((
PyObject
*
)
memview
==
Py_None
)
{
memslice
->
memview
=
NULL
;
return
;
return
;
}
if
(
memview
->
acquisition_count
<=
0
)
if
(
memview
->
acquisition_count
<=
0
)
__pyx_fatalerror
(
"Acquisition count is %d (line %d)"
,
__pyx_fatalerror
(
"Acquisition count is %d (line %d)"
,
...
...
tests/run/memslice.pyx
View file @
69cca645
...
@@ -2185,3 +2185,20 @@ def test_noneslice_ext_attr():
...
@@ -2185,3 +2185,20 @@ def test_noneslice_ext_attr():
obj
.
m
=
None
obj
.
m
=
None
print
obj
.
m
print
obj
.
m
@
testcase
def
test_noneslice_del
():
"""
>>> test_noneslice_del()
Traceback (most recent call last):
...
UnboundLocalError: local variable 'm' referenced before assignment
"""
cdef
int
[
10
]
a
cdef
int
[:]
m
=
a
with
cython
.
nonecheck
(
True
):
m
=
None
del
m
print
m
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