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
de9757c2
Commit
de9757c2
authored
Aug 28, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incref in test + have_gil arg to xdec_memview on err/return
parent
b3d97a43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
16 deletions
+12
-16
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-10
tests/run/memslice.pyx
tests/run/memslice.pyx
+6
-6
No files found.
Cython/Compiler/Nodes.py
View file @
de9757c2
...
...
@@ -1509,8 +1509,6 @@ class FuncDefNode(StatNode, BlockNode):
for
entry
in
lenv
.
buffer_entries
:
Buffer
.
put_release_buffer_code
(
code
,
entry
)
#code.putln("%s = 0;" % entry.cname)
#for entry in memslice_entries:
# code.put_xdecref_memoryviewslice(entry.cname)
code
.
putln
(
"__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}"
)
if
self
.
return_type
.
is_memoryviewslice
:
...
...
@@ -1597,8 +1595,8 @@ class FuncDefNode(StatNode, BlockNode):
continue
if
entry
.
type
.
is_memoryviewslice
:
#code.put_xdecref("%s.memview" % entry.cname, cython_memoryview_ptr_type)
code
.
put_xdecref_memoryviewslice
(
entry
.
cname
)
code
.
put_xdecref_memoryviewslice
(
entry
.
cname
,
have_gil
=
not
lenv
.
nogil
)
elif
entry
.
type
.
is_pyobject
:
code
.
put_var_decref
(
entry
)
...
...
@@ -1609,8 +1607,8 @@ class FuncDefNode(StatNode, BlockNode):
if
(
acquire_gil
or
entry
.
assignments
)
and
not
entry
.
in_closure
:
code
.
put_var_decref
(
entry
)
if
entry
.
type
.
is_memoryviewslice
:
code
.
put_xdecref_memoryviewslice
(
entry
.
cname
)
#code.put_decref("%s.memview" % entry.cname, cython_memoryview_ptr_type
)
code
.
put_xdecref_memoryviewslice
(
entry
.
cname
,
have_gil
=
not
lenv
.
nogil
)
if
self
.
needs_closure
:
code
.
put_decref
(
Naming
.
cur_scope_cname
,
lenv
.
scope_class
.
type
)
...
...
@@ -1654,7 +1652,7 @@ class FuncDefNode(StatNode, BlockNode):
# ----- Go back and insert temp variable declarations
tempvardecl_code
.
put_temp_declarations
(
code
.
funcstate
)
if
code
.
funcstate
.
should_declare_error_indicator
:
# Initialize these variables to s
hut up
compiler warnings
# Initialize these variables to s
ilence
compiler warnings
tempvardecl_code
.
putln
(
"int %s = 0;"
%
Naming
.
lineno_cname
)
tempvardecl_code
.
putln
(
"const char *%s = NULL;"
%
Naming
.
filename_cname
)
...
...
@@ -4347,8 +4345,6 @@ class ReturnStatNode(StatNode):
if
self
.
return_type
.
is_pyobject
:
code
.
put_xdecref
(
Naming
.
retval_cname
,
self
.
return_type
)
#elif self.return_type.is_memoryviewslice:
# code.put_xdecref_memoryviewslice(Naming.retval_cname)
if
self
.
value
:
self
.
value
.
generate_evaluation_code
(
code
)
...
...
@@ -4360,7 +4356,7 @@ class ReturnStatNode(StatNode):
lhs_pos
=
self
.
value
.
pos
,
rhs
=
self
.
value
,
code
=
code
,
incref_rhs
=
value
.
is_name
,
incref_rhs
=
self
.
value
.
is_name
,
have_gil
=
self
.
in_nogil_context
)
else
:
self
.
value
.
make_owned_reference
(
code
)
...
...
tests/run/memslice.pyx
View file @
de9757c2
...
...
@@ -1095,7 +1095,7 @@ class UniqueObject(object):
return
self
.
value
objs
=
[[
UniqueObject
(
"spam"
)],
[
UniqueObject
(
"ham"
)],
[
UniqueObject
(
"eggs"
)]]
addref
(
*
objs
)
addref
(
*
[
obj
for
L
in
objs
for
obj
in
L
]
)
cdef
cdef
_function
(
int
[:]
buf1
,
object
[::
view
.
indirect
,
:]
buf2
=
ObjectMockBuffer
(
None
,
objs
)):
print
'cdef called'
print
buf1
[
6
],
buf2
[
1
,
0
]
...
...
@@ -1115,11 +1115,11 @@ def test_cdef_function(o1, o2=None):
6 eggs
released A
>> L = [[x] for x in range(25)]
>>
addref(*L
)
>> B = ObjectMockBuffer("B", L, shape=(5, 5))
>>
>
L = [[x] for x in range(25)]
>>
> addref(*[obj for mylist in L for obj in mylist]
)
>>
>
B = ObjectMockBuffer("B", L, shape=(5, 5))
>> test_cdef_function(A, B)
>>
>
test_cdef_function(A, B)
acquired A
cdef called
6 eggs
...
...
@@ -1143,7 +1143,7 @@ def test_cdef_function(o1, o2=None):
cdef
int
[:]
global_A
=
IntMockBuffer
(
"Global_A"
,
range
(
10
))
addref
(
*
objs
)
addref
(
*
[
obj
for
L
in
objs
for
obj
in
L
]
)
cdef
object
[::
view
.
indirect
,
:]
global_B
=
ObjectMockBuffer
(
None
,
objs
)
cdef
cdef
_function2
(
int
[:]
buf1
,
object
[::
view
.
indirect
,
:]
buf2
=
global_B
):
...
...
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