ASF GitHub Bot commented on ARROW-2173:

wesm closed pull request #1627: ARROW-2173: [C++/Python] Hold the GIL in 
NumPyBuffer destructor
URL: https://github.com/apache/arrow/pull/1627

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cpp/src/arrow/python/numpy_convert.cc 
index c2d055fce..7ba13877d 100644
--- a/cpp/src/arrow/python/numpy_convert.cc
+++ b/cpp/src/arrow/python/numpy_convert.cc
@@ -76,7 +76,10 @@ NumPyBuffer::NumPyBuffer(PyObject* ao) : Buffer(nullptr, 0) {
-NumPyBuffer::~NumPyBuffer() { Py_XDECREF(arr_); }
+NumPyBuffer::~NumPyBuffer() {
+  PyAcquireGIL lock;
+  Py_XDECREF(arr_);
   case NPY_##NPY_NAME:                        \


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> [Python] NumPyBuffer destructor should hold the GIL
> ---------------------------------------------------
>                 Key: ARROW-2173
>                 URL: https://issues.apache.org/jira/browse/ARROW-2173
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>            Reporter: Antoine Pitrou
>            Assignee: Antoine Pitrou
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
> Failure to hold the GIL can lead to crashes, depending on presence of several 
> threads or whatever the object allocator needs to do.

This message was sent by Atlassian JIRA

Reply via email to