You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by jo...@apache.org on 2023/12/19 08:45:06 UTC
(arrow) branch main updated: GH-38535: [Python] Fix S3FileSystem equals None segfault (#39276)
This is an automated email from the ASF dual-hosted git repository.
jorisvandenbossche pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new f5dd3d4a1c GH-38535: [Python] Fix S3FileSystem equals None segfault (#39276)
f5dd3d4a1c is described below
commit f5dd3d4a1c0efb7c8587287da0c536988bcd1559
Author: Alenka Frim <Al...@users.noreply.github.com>
AuthorDate: Tue Dec 19 09:45:00 2023 +0100
GH-38535: [Python] Fix S3FileSystem equals None segfault (#39276)
### Rationale for this change
`S3FileSystem` equals `None` currently causes bus error.
### What changes are included in this PR?
Add `not None` to `FileSystem.equals` signature.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* Closes: #38535
Authored-by: AlenkaF <fr...@gmail.com>
Signed-off-by: Joris Van den Bossche <jo...@gmail.com>
---
python/pyarrow/_fs.pyx | 2 +-
python/pyarrow/tests/test_fs.py | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/python/pyarrow/_fs.pyx b/python/pyarrow/_fs.pyx
index ef8db31bfc..395f488144 100644
--- a/python/pyarrow/_fs.pyx
+++ b/python/pyarrow/_fs.pyx
@@ -505,7 +505,7 @@ cdef class FileSystem(_Weakrefable):
cdef inline shared_ptr[CFileSystem] unwrap(self) nogil:
return self.wrapped
- def equals(self, FileSystem other):
+ def equals(self, FileSystem other not None):
"""
Parameters
----------
diff --git a/python/pyarrow/tests/test_fs.py b/python/pyarrow/tests/test_fs.py
index 59c9c44942..d0fa253e31 100644
--- a/python/pyarrow/tests/test_fs.py
+++ b/python/pyarrow/tests/test_fs.py
@@ -542,6 +542,13 @@ def test_filesystem_equals():
assert SubTreeFileSystem('/base', fs0) != SubTreeFileSystem('/other', fs0)
+def test_filesystem_equals_none(fs):
+ with pytest.raises(TypeError, match="got NoneType"):
+ fs.equals(None)
+
+ assert fs is not None
+
+
def test_subtree_filesystem():
localfs = LocalFileSystem()