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
e51ea079
Commit
e51ea079
authored
Jul 29, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buffers: Fixed problem with preserving exception through release phase
parent
00209341
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+15
-2
tests/run/bufaccess.pyx
tests/run/bufaccess.pyx
+2
-5
No files found.
Cython/Compiler/Buffer.py
View file @
e51ea079
...
...
@@ -141,9 +141,22 @@ def put_acquire_arg_buffer(entry, code, pos):
# need to do care about the buffer then.
put_unpack_buffer_aux_into_scope
(
buffer_aux
,
code
)
#def put_release_buffer_normal(entry, code):
# code.putln("if (%s != Py_None) PyObject_ReleaseBuffer(%s, &%s);" % (
# entry.cname,
# entry.cname,
# entry.buffer_aux.buffer_info_var.cname))
def
put_release_buffer
(
entry
,
code
):
code
.
putln
(
"if (%s != Py_None) PyObject_ReleaseBuffer(%s, &%s);"
%
(
entry
.
cname
,
entry
.
cname
,
entry
.
buffer_aux
.
buffer_info_var
.
cname
))
code
.
putln
(
dedent
(
"""
\
if (%s != Py_None) {
PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb);
PyObject_ReleaseBuffer(%s, &%s);
PyErr_Restore(__pyx_type, __pyx_value, __pyx_tb);
}"""
%
(
entry
.
cname
,
entry
.
cname
,
entry
.
buffer_aux
.
buffer_info_var
.
cname
)))
def
put_assign_to_buffer
(
lhs_cname
,
rhs_cname
,
retcode_cname
,
buffer_aux
,
buffer_type
,
is_initialized
,
pos
,
code
):
...
...
tests/run/bufaccess.pyx
View file @
e51ea079
...
...
@@ -46,8 +46,7 @@ def acquire_release(o1, o2):
buf
=
o1
buf
=
o2
#TODO!
#@testcase
@
testcase
def
acquire_raise
(
o
):
"""
Apparently, doctest won't handle mixed exceptions and print
...
...
@@ -61,11 +60,9 @@ def acquire_raise(o):
>>> A.printlog()
acquired A
released A
"""
cdef
object
[
int
]
buf
buf
=
o
o
.
printlog
()
raise
Exception
(
"on purpose"
)
@
testcase
...
...
@@ -614,7 +611,7 @@ cdef class MockBuffer:
def
__releasebuffer__
(
MockBuffer
self
,
Py_buffer
*
buffer
):
msg
=
"released %s"
%
self
.
label
print
msg
print
msg
self
.
log
+=
msg
+
"
\
n
"
def
printlog
(
self
):
...
...
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