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
61ee2ad0
Commit
61ee2ad0
authored
Aug 06, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buffers: More stable buffer release code
parent
a313eb32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+2
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-0
No files found.
Cython/Compiler/Buffer.py
View file @
61ee2ad0
...
...
@@ -157,8 +157,7 @@ def put_acquire_arg_buffer(entry, code, pos):
# entry.buffer_aux.buffer_info_var.cname))
def
get_release_buffer_code
(
entry
):
return
"if (%s != Py_None) __Pyx_ReleaseBuffer(%s, &%s)"
%
(
entry
.
cname
,
return
"__Pyx_ReleaseBuffer(%s, &%s)"
%
(
entry
.
cname
,
entry
.
buffer_aux
.
buffer_info_var
.
cname
)
...
...
@@ -190,11 +189,8 @@ def put_assign_to_buffer(lhs_cname, rhs_cname, buffer_aux, buffer_type,
if
is_initialized
:
# Release any existing buffer
code
.
put
(
'if (%s != Py_None) '
%
lhs_cname
)
code
.
begin_block
();
code
.
putln
(
'__Pyx_ReleaseBuffer(%s, &%s);'
%
(
lhs_cname
,
bufstruct
))
code
.
end_block
()
# Acquire
retcode_cname
=
code
.
funcstate
.
allocate_temp
(
PyrexTypes
.
c_int_type
)
code
.
putln
(
"%s = %s;"
%
(
retcode_cname
,
getbuffer
%
rhs_cname
))
...
...
@@ -558,6 +554,7 @@ static INLINE const char* __Pyx_BufferTypestringCheckEndian(const char* ts); /*p
static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/
"""
,
"""
static INLINE void __Pyx_ReleaseBuffer(PyObject* obj, Py_buffer* info) {
if (info->buf == NULL) return;
if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
PyObject_ReleaseBuffer(obj, info);
}
...
...
Cython/Compiler/Nodes.py
View file @
61ee2ad0
...
...
@@ -900,6 +900,8 @@ class FuncDefNode(StatNode, BlockNode):
for
entry
in
lenv
.
var_entries
:
if
entry
.
type
.
is_pyobject
and
entry
.
init_to_none
and
entry
.
used
:
code
.
put_init_var_to_py_none
(
entry
)
if
entry
.
type
.
is_buffer
and
entry
.
buffer_aux
.
buffer_info_var
.
used
:
code
.
putln
(
"%s.buf = NULL;"
%
entry
.
buffer_aux
.
buffer_info_var
.
cname
)
# ----- Check and convert arguments
self
.
generate_argument_type_tests
(
code
)
# ----- Function body
...
...
@@ -2047,8 +2049,11 @@ class CClassDefNode(ClassDefNode):
# body StatNode or None
# entry Symtab.Entry
# base_type PyExtensionType or None
# bufferdefaults dict or None Declares defaults for a buffer
child_attrs
=
[
"body"
]
bufferdefaults
=
None
def
analyse_declarations
(
self
,
env
):
#print "CClassDefNode.analyse_declarations:", self.class_name
...
...
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