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 1ed4019  ARROW-2072: [Python] Fix crash in decimal128.byte_width
1ed4019 is described below

commit 1ed4019a2249be68de81854c79acf5f353c18d51
Author: Antoine Pitrou <[email protected]>
AuthorDate: Thu Feb 1 08:19:42 2018 -0500

    ARROW-2072: [Python] Fix crash in decimal128.byte_width
    
    Author: Antoine Pitrou <[email protected]>
    
    Closes #1542 from pitrou/ARROW-2072-decimal-byte-width-crash and squashes 
the following commits:
    
    bc1e15b1 [Antoine Pitrou] ARROW-2072: [Python] Fix crash in 
decimal128.byte_width
---
 python/pyarrow/tests/test_types.py | 10 ++++++++++
 python/pyarrow/types.pxi           |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/tests/test_types.py 
b/python/pyarrow/tests/test_types.py
index 68dc499..ad683e9 100644
--- a/python/pyarrow/tests/test_types.py
+++ b/python/pyarrow/tests/test_types.py
@@ -184,3 +184,13 @@ def test_types_hashable():
 ])
 def test_exact_primitive_types(t, check_func):
     assert check_func(t)
+
+
+def test_fixed_size_binary_byte_width():
+    ty = pa.binary(5)
+    assert ty.byte_width == 5
+
+
+def test_decimal_byte_width():
+    ty = pa.decimal128(19, 4)
+    assert ty.byte_width == 16
diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi
index a3cbeef..849a0e0 100644
--- a/python/pyarrow/types.pxi
+++ b/python/pyarrow/types.pxi
@@ -293,7 +293,7 @@ cdef class FixedSizeBinaryType(DataType):
 cdef class Decimal128Type(FixedSizeBinaryType):
 
     cdef void init(self, const shared_ptr[CDataType]& type):
-        DataType.init(self, type)
+        FixedSizeBinaryType.init(self, type)
         self.decimal128_type = <const CDecimal128Type*> type.get()
 
     def __getstate__(self):

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to