You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2021/06/08 15:20:07 UTC
[arrow] branch master updated: ARROW-12993: [Python] Avoid
half-initialized FeatherReader object
This is an automated email from the ASF dual-hosted git repository.
apitrou 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 882c246 ARROW-12993: [Python] Avoid half-initialized FeatherReader object
882c246 is described below
commit 882c2468a4159d27fd0bd4c7736bb540d09a568d
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Tue Jun 8 17:18:58 2021 +0200
ARROW-12993: [Python] Avoid half-initialized FeatherReader object
When trying to read an invalid Feather file, the `stackprinter` project
would crash when walking the stack and attempting to print detailed information
about captured local variables.
Specifically, the crash would occur when looking up the `version` attribute
on the half-initialized FeatherReader object.
Closes #10480 from pitrou/ARROW-12993-feather-uninitialized
Authored-by: Antoine Pitrou <an...@python.org>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
python/pyarrow/_feather.pyx | 6 +-----
python/pyarrow/feather.py | 3 +--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/python/pyarrow/_feather.pyx b/python/pyarrow/_feather.pyx
index 3939dd5..2f46bb9 100644
--- a/python/pyarrow/_feather.pyx
+++ b/python/pyarrow/_feather.pyx
@@ -69,13 +69,9 @@ cdef class FeatherReader(_Weakrefable):
cdef:
shared_ptr[CFeatherReader] reader
- def __cinit__(self):
- pass
-
- def open(self, source, c_bool use_memory_map=True):
+ def __cinit__(self, source, c_bool use_memory_map):
cdef shared_ptr[CRandomAccessFile] reader
get_reader(source, use_memory_map, &reader)
-
with nogil:
self.reader = GetResultValue(CFeatherReader.Open(reader))
diff --git a/python/pyarrow/feather.py b/python/pyarrow/feather.py
index b184e2b..1e6875a 100644
--- a/python/pyarrow/feather.py
+++ b/python/pyarrow/feather.py
@@ -236,8 +236,7 @@ def read_table(source, columns=None, memory_map=True):
-------
table : pyarrow.Table
"""
- reader = _feather.FeatherReader()
- reader.open(source, use_memory_map=memory_map)
+ reader = _feather.FeatherReader(source, use_memory_map=memory_map)
if columns is None:
return reader.read()