This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 62c55ec  ARROW-2133: [Python] Fix segfault on conversion of empty 
nested array to Pandas
62c55ec is described below

commit 62c55ecdb237c73a96553252937e92180dffd4eb
Author: Antoine Pitrou <anto...@python.org>
AuthorDate: Mon Feb 12 14:45:34 2018 -0500

    ARROW-2133: [Python] Fix segfault on conversion of empty nested array to 
Pandas
    
    Based on PR #1588
    
    Author: Antoine Pitrou <anto...@python.org>
    
    Closes #1591 from pitrou/ARROW-2133-segfault-nested-array-to-pandas and 
squashes the following commits:
    
    3ac6e522 [Antoine Pitrou] ARROW-2133: [Python] Fix segfault on conversion 
of empty nested arrays to Pandas
---
 cpp/src/arrow/python/arrow_to_pandas.cc     | 2 +-
 python/pyarrow/tests/test_convert_pandas.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc 
b/cpp/src/arrow/python/arrow_to_pandas.cc
index 0488989..125892a 100644
--- a/cpp/src/arrow/python/arrow_to_pandas.cc
+++ b/cpp/src/arrow/python/arrow_to_pandas.cc
@@ -519,7 +519,7 @@ inline Status ConvertListsLike(PandasOptions options, const 
std::shared_ptr<Colu
   // TODO(ARROW-489): Currently we don't have a Python reference for single 
columns.
   //    Storing a reference to the whole Array would be to expensive.
 
-  OwnedRef owned_numpy_array;
+  OwnedRefNoGIL owned_numpy_array;
   RETURN_NOT_OK(
       ConvertColumnToPandas(options, flat_column, nullptr, 
owned_numpy_array.ref()));
 
diff --git a/python/pyarrow/tests/test_convert_pandas.py 
b/python/pyarrow/tests/test_convert_pandas.py
index b825dfc..026cd25 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -1351,6 +1351,10 @@ class TestPandasConversion(object):
         tm.assert_almost_equal(arr.to_pandas(), np.array([], dtype=np.int64))
         arr = pa.array([], type=pa.string())
         tm.assert_almost_equal(arr.to_pandas(), np.array([], dtype=object))
+        arr = pa.array([], type=pa.list_(pa.int64()))
+        tm.assert_almost_equal(arr.to_pandas(), np.array([], dtype=object))
+        arr = pa.array([], type=pa.struct([pa.field('a', pa.int64())]))
+        tm.assert_almost_equal(arr.to_pandas(), np.array([], dtype=object))
 
     def test_array_from_pandas_date_with_mask(self):
         m = np.array([True, False, True])

-- 
To stop receiving notification emails like this one, please contact
w...@apache.org.

Reply via email to