You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/07/22 15:18:03 UTC
[arrow] branch master updated: ARROW-17142: [Python] Parquet FileMetadata.equals() method segfaults when passed None (#13658)
This is an automated email from the ASF dual-hosted git repository.
lidavidm 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 b3ce0fa7b6 ARROW-17142: [Python] Parquet FileMetadata.equals() method segfaults when passed None (#13658)
b3ce0fa7b6 is described below
commit b3ce0fa7b682c891a33b4ac44711e949f9eff577
Author: Kshiteej K <ks...@gmail.com>
AuthorDate: Fri Jul 22 20:47:56 2022 +0530
ARROW-17142: [Python] Parquet FileMetadata.equals() method segfaults when passed None (#13658)
Fixes : https://issues.apache.org/jira/browse/ARROW-17142
Authored-by: kshitij12345 <ks...@gmail.com>
Signed-off-by: David Li <li...@gmail.com>
---
python/pyarrow/_parquet.pyx | 2 +-
python/pyarrow/tests/parquet/test_metadata.py | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/python/pyarrow/_parquet.pyx b/python/pyarrow/_parquet.pyx
index e0d4ba76ad..66ed7db997 100644
--- a/python/pyarrow/_parquet.pyx
+++ b/python/pyarrow/_parquet.pyx
@@ -667,7 +667,7 @@ cdef class FileMetaData(_Weakrefable):
except TypeError:
return NotImplemented
- def equals(self, FileMetaData other):
+ def equals(self, FileMetaData other not None):
"""
Return whether the two file metadata objects are equal.
diff --git a/python/pyarrow/tests/parquet/test_metadata.py b/python/pyarrow/tests/parquet/test_metadata.py
index bad4984796..b36ea60658 100644
--- a/python/pyarrow/tests/parquet/test_metadata.py
+++ b/python/pyarrow/tests/parquet/test_metadata.py
@@ -531,3 +531,15 @@ def test_metadata_exceeds_message_size():
buf = out.getvalue()
metadata = pq.read_metadata(pa.BufferReader(buf))
+
+
+def test_metadata_equals():
+ table = pa.table({"a": [1, 2, 3]})
+ with pa.BufferOutputStream() as out:
+ pq.write_table(table, out)
+ buf = out.getvalue()
+
+ original_metadata = pq.read_metadata(pa.BufferReader(buf))
+ match = "Argument 'other' has incorrect type"
+ with pytest.raises(TypeError, match=match):
+ original_metadata.equals(None)