You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/12/06 15:07:24 UTC

[arrow] branch master updated: ARROW-3586: [Python] Add test ensuring no segfault

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 dd1ab19  ARROW-3586: [Python] Add test ensuring no segfault
dd1ab19 is described below

commit dd1ab19907e6546a4d255d69767bf21110784864
Author: François Saint-Jacques <fs...@gmail.com>
AuthorDate: Thu Dec 6 09:07:16 2018 -0600

    ARROW-3586: [Python] Add test ensuring no segfault
    
    As reported in ARROW-3586, a conversion to categorical on an empty array
    would trigger a segfault. This test ensure it is safe to do.
    
    Author: François Saint-Jacques <fs...@gmail.com>
    
    Closes #3116 from fsaintjacques/ARROW-3586-segfault and squashes the following commits:
    
    7f779f1bf <François Saint-Jacques> ARROW-3586:  Add test ensuring no segfault
---
 python/pyarrow/tests/test_convert_pandas.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/python/pyarrow/tests/test_convert_pandas.py b/python/pyarrow/tests/test_convert_pandas.py
index e4f38ff..ce9d6d1 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -1362,6 +1362,13 @@ class TestConvertStringLikeTypes(object):
         result4 = table.to_pandas(categories=tuple())
         tm.assert_frame_equal(result4, expected_str, check_dtype=True)
 
+    def test_to_pandas_categorical_zero_length(self):
+        # ARROW-3586
+        array = pa.array([], type=pa.int32())
+        table = pa.Table.from_arrays(arrays=[array], names=['col'])
+        # This would segfault under 0.11.0
+        table.to_pandas(categories=['col'])
+
     def test_table_str_to_categorical_without_na(self):
         values = ['a', 'a', 'b', 'b', 'c']
         df = pd.DataFrame({'strings': values})