From f084ca822607600983c047b0c4e0687db7ceb492 Mon Sep 17 00:00:00 2001 From: Joel Mason Date: Thu, 15 Nov 2018 19:52:19 +1100 Subject: [PATCH 1/2] Fix Segfault during finalization Basically icorporates changes introduced in #603 --- src/pybuffer.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybuffer.jl b/src/pybuffer.jl index ea076e1f..2b361496 100644 --- a/src/pybuffer.jl +++ b/src/pybuffer.jl @@ -48,7 +48,7 @@ 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 From 51e289ddf5e11b4532d4ed23744fa2912d2ea290 Mon Sep 17 00:00:00 2001 From: Joel Mason Date: Thu, 15 Nov 2018 23:24:21 +1100 Subject: [PATCH 2/2] Fix typo --- src/pybuffer.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybuffer.jl b/src/pybuffer.jl index 2b361496..5a25805b 100644 --- a/src/pybuffer.jl +++ b/src/pybuffer.jl @@ -42,7 +42,7 @@ 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