Repository: arrow Updated Branches: refs/heads/master cf1ac9cf4 -> 576fb6651
ARROW-1532: [Python] Referencing an Empty Schema causes a SegFault Author: Phillip Cloud <[email protected]> Closes #1096 from cpcloud/ARROW-1532 and squashes the following commits: 7f43c6c7 [Phillip Cloud] ARROW-1532: [Python] Referencing an Empty Schema causes a SegFault Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/576fb665 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/576fb665 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/576fb665 Branch: refs/heads/master Commit: 576fb6651257c7c967c613fd20232ee80a434f0e Parents: cf1ac9c Author: Phillip Cloud <[email protected]> Authored: Tue Sep 12 17:54:13 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Tue Sep 12 17:54:13 2017 -0400 ---------------------------------------------------------------------- python/pyarrow/tests/test_table.py | 9 +++++++++ python/pyarrow/types.pxi | 2 ++ 2 files changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/576fb665/python/pyarrow/tests/test_table.py ---------------------------------------------------------------------- diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 4d5cb36..311d64e 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -285,3 +285,12 @@ def test_table_negative_indexing(): def test_table_ctor_errors(): with pytest.raises(ReferenceError): repr(pa.Table()) + with pytest.raises(ReferenceError): + str(pa.Table()) + + +def test_schema_ctor_errors(): + with pytest.raises(ReferenceError): + repr(pa.Schema()) + with pytest.raises(ReferenceError): + str(pa.Schema()) http://git-wip-us.apache.org/repos/asf/arrow/blob/576fb665/python/pyarrow/types.pxi ---------------------------------------------------------------------- diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi index 56670f6..b298e74 100644 --- a/python/pyarrow/types.pxi +++ b/python/pyarrow/types.pxi @@ -436,6 +436,8 @@ cdef class Schema: return pyarrow_wrap_schema(new_schema) def __str__(self): + self._check_null() + cdef: PrettyPrintOptions options c_string result
