FileMetaData has no __cinit__ that default-constructs c_obj, so any instance created via
FileMetaData.__new__(FileMetaData) (bypassing __init__, which raises) has a null c_obj.
Any dereference(self.c_obj) call then segfaults instead of raising a Python exception:
|
def __init__(self): |
|
raise ValueError("FileMetaData cannot be constructed directly") |
|
|
|
@staticmethod |
|
cdef FileMetaData from_libcudf(unique_ptr[cpp_FileMetaData] metadata): |
|
cdef FileMetaData result = FileMetaData.__new__(FileMetaData) |
|
result.c_obj = move(metadata) |
|
return result |
Previously c_obj was an embedded (non-pointer) value and could not be null, so this is a
regression in safety introduced by PR #23558 (which switched FileMetaData to hold a
unique_ptr so it could be shared/reused, e.g. from hybrid_scan.pyx).
Scalar has the same unique_ptr + from_libcudf-only pattern elsewhere in pylibcudf, so this
may be worth fixing generally rather than just for FileMetaData.
Related
FileMetaDatahas no__cinit__that default-constructsc_obj, so any instance created viaFileMetaData.__new__(FileMetaData)(bypassing__init__, which raises) has a nullc_obj.Any
dereference(self.c_obj)call then segfaults instead of raising a Python exception:cudf/python/pylibcudf/pylibcudf/io/parquet_metadata.pyx
Lines 473 to 480 in d4ecace
Previously
c_objwas an embedded (non-pointer) value and could not be null, so this is aregression in safety introduced by PR #23558 (which switched
FileMetaDatato hold aunique_ptrso it could be shared/reused, e.g. fromhybrid_scan.pyx).Scalarhas the sameunique_ptr+from_libcudf-only pattern elsewhere in pylibcudf, so thismay be worth fixing generally rather than just for
FileMetaData.Related
plc.io.parquet.read_parquetwith prefetched parquet file metadata. #23558 (introduced theunique_ptrchange)plc.io.parquet.read_parquetwith prefetched parquet file metadata. #23558 (comment)