[
https://issues.apache.org/jira/browse/ARROW-2072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16348567#comment-16348567
]
ASF GitHub Bot commented on ARROW-2072:
---------------------------------------
wesm closed pull request #1542: ARROW-2072: [Python] Fix crash in
decimal128.byte_width
URL: https://github.com/apache/arrow/pull/1542
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/python/pyarrow/tests/test_types.py
b/python/pyarrow/tests/test_types.py
index 68dc499cf..ad683e9a2 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 a3cbeefb0..849a0e016 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):
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [Python] decimal128.byte_width crashes
> --------------------------------------
>
> Key: ARROW-2072
> URL: https://issues.apache.org/jira/browse/ARROW-2072
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.8.0
> Reporter: Antoine Pitrou
> Assignee: Antoine Pitrou
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
> {code:bash}
> $ python -c "import pyarrow as pa; ty = pa.decimal128(20, 7);
> print(ty.byte_width)"
> Erreur de segmentation (core dumped)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)