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 2017/03/13 17:16:12 UTC
arrow git commit: ARROW-623: Fix segfault in __repr__ of empty field
Repository: arrow
Updated Branches:
refs/heads/master 2cf36ef2d -> 331be4923
ARROW-623: Fix segfault in __repr__ of empty field
Small fix for not segfaulting when printing an empty field.
Author: Miki Tebeka <mi...@gmail.com>
Closes #374 from tebeka/field-bug and squashes the following commits:
abcd118 [Miki Tebeka] ARROW-623: Fix segfault in __repr__ of empty field
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/331be492
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/331be492
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/331be492
Branch: refs/heads/master
Commit: 331be4923ac4b30dafa7e79785b71b89ddeb8f3c
Parents: 2cf36ef
Author: Miki Tebeka <mi...@gmail.com>
Authored: Mon Mar 13 13:16:04 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Mon Mar 13 13:16:04 2017 -0400
----------------------------------------------------------------------
python/pyarrow/schema.pyx | 3 +++
python/pyarrow/tests/test_schema.py | 7 +++++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/331be492/python/pyarrow/schema.pyx
----------------------------------------------------------------------
diff --git a/python/pyarrow/schema.pyx b/python/pyarrow/schema.pyx
index 19910ab..d636b5a 100644
--- a/python/pyarrow/schema.pyx
+++ b/python/pyarrow/schema.pyx
@@ -111,6 +111,9 @@ cdef class Field:
property name:
def __get__(self):
+ if box_field(self.sp_field) is None:
+ raise ReferenceError(
+ 'Field not initialized (references NULL pointer)')
return frombytes(self.field.name)
http://git-wip-us.apache.org/repos/asf/arrow/blob/331be492/python/pyarrow/tests/test_schema.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_schema.py b/python/pyarrow/tests/test_schema.py
index f6dc33c..dd68f39 100644
--- a/python/pyarrow/tests/test_schema.py
+++ b/python/pyarrow/tests/test_schema.py
@@ -87,3 +87,10 @@ baz: list<item: int8>"""
del fields[-1]
sch3 = A.schema(fields)
assert not sch1.equals(sch3)
+
+
+class TestField(unittest.TestCase):
+ def test_empty_field(self):
+ f = arrow.Field()
+ with self.assertRaises(ReferenceError):
+ repr(f)