Skip to content

Commit

Permalink
Fix Segfault during finalization (#615)
Browse files Browse the repository at this point in the history
* Fix Segfault during finalization

Basically icorporates changes introduced in #603

* Fix typo
  • Loading branch information
JobJob authored and stevengj committed Nov 15, 2018
1 parent e74bf61 commit 1e0dce1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pybuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ end
Release the reference to buffer `o`
N.b. As per https://docs.python.org/3/c-api/buffer.html#c.PyBuffer_Release,
It is an error to call this function on a PyBuffer that was not obtained via
the python c-api function `PyObject_GetBuffer(), unless o.obj is a PyPtr(C_NULL)`
the python c-api function `PyObject_GetBuffer()`, unless o.obj is a PyPtr(C_NULL)
"""
function pydecref(o::PyBuffer)
# note that PyBuffer_Release sets o.obj to NULL, and
# is a no-op if o.obj is already NULL
# TODO change to `Ref{PyBuffer}` when 0.6 is dropped.
ccall(@pysym(:PyBuffer_Release), Cvoid, (Any,), o)
_finalized[] || ccall(@pysym(:PyBuffer_Release), Cvoid, (Any,), o)
o
end

Expand Down

0 comments on commit 1e0dce1

Please sign in to comment.