raulcd commented on PR #44395:
URL: https://github.com/apache/arrow/pull/44395#issuecomment-2410925680
@jorisvandenbossche any idea why the Python verification has just started
failing for the above?
<details>
```
=================================== FAILURES
===================================
_____________________________ test_legacy_int_type
_____________________________
def test_legacy_int_type():
with pytest.warns(FutureWarning, match="PyExtensionType is
deprecated"):
ext_ty = LegacyIntType()
arr = pa.array([1, 2, 3], type=ext_ty.storage_type)
ext_arr = pa.ExtensionArray.from_storage(ext_ty, arr)
batch = pa.RecordBatch.from_arrays([ext_arr], names=['ext'])
buf = ipc_write_batch(batch)
with pytest.warns((RuntimeWarning, FutureWarning)):
> batch = ipc_read_batch(buf)
pyarrow/tests/test_extension_type.py:1722:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
pyarrow/tests/test_extension_type.py:254: in ipc_read_batch
reader = pa.RecordBatchStreamReader(buf)
pyarrow/ipc.py:52: in __init__
self._open(source, options=options, memory_pool=memory_pool)
pyarrow/ipc.pxi:1006: in pyarrow.lib._RecordBatchStreamReader._open
self.reader = GetResultValue(CRecordBatchStreamReader.Open(
pyarrow/error.pxi:155: in pyarrow.lib.pyarrow_internal_check_status
return check_status(status)
pyarrow/error.pxi:89: in pyarrow.lib.check_status
RestorePyError(status)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
cls = <class
'pandas.core.arrays.arrow.extension_types.patch_pyarrow.<locals>.ForbiddenExtensionType'>
storage_type = DataType(int8)
serialized =
b'\x80\x04\x95:\x00\x00\x00\x00\x00\x00\x00\x8c!pyarrow.tests.test_extension_type\x94\x8c\rLegacyIntType\x94\x93\x94)R\x94.'
@classmethod
def __arrow_ext_deserialize__(cls, storage_type, serialized):
import io
import pickletools
out = io.StringIO()
pickletools.dis(serialized, out)
> raise RuntimeError(
_ERROR_MSG.format(
storage_type=storage_type,
serialized=serialized,
pickle_disassembly=out.getvalue(),
)
)
E RuntimeError: Disallowed deserialization of
'arrow.py_extension_type':
E storage_type = int8
E serialized =
b'\x80\x04\x95:\x00\x00\x00\x00\x00\x00\x00\x8c!pyarrow.tests.test_extension_type\x94\x8c\rLegacyIntType\x94\x93\x94)R\x94.'
E pickle disassembly:
E 0: \x80 PROTO 4
E 2: \x95 FRAME 58
E 11: \x8c SHORT_BINUNICODE 'pyarrow.tests.test_extension_type'
E 46: \x94 MEMOIZE (as 0)
E 47: \x8c SHORT_BINUNICODE 'LegacyIntType'
E 62: \x94 MEMOIZE (as 1)
E 63: \x93 STACK_GLOBAL
E 64: \x94 MEMOIZE (as 2)
E 65: ) EMPTY_TUPLE
E 66: R REDUCE
E 67: \x94 MEMOIZE (as 3)
E 68: . STOP
E highest protocol among opcodes = 4
E
E
E Reading of untrusted Parquet or Feather files with a PyExtensionType
column
E allows arbitrary code execution.
E If you trust this file, you can enable reading the extension type by
one of:
E
E - upgrading to pyarrow >= 14.0.1, and call
`pa.PyExtensionType.set_auto_load(True)`
E - install pyarrow-hotfix (`pip install pyarrow-hotfix`) and disable
it by running
E `import pyarrow_hotfix; pyarrow_hotfix.uninstall()`
E
E We strongly recommend updating your Parquet/Feather files to use
extension types
E derived from `pyarrow.ExtensionType` instead, and register this type
explicitly.
/tmp/arrow-HEAD.LSNAi/venv-source/lib64/python3.11/site-packages/pandas/core/arrays/arrow/extension_types.py:158:
RuntimeError
During handling of the above exception, another exception occurred:
def test_legacy_int_type():
with pytest.warns(FutureWarning, match="PyExtensionType is
deprecated"):
ext_ty = LegacyIntType()
arr = pa.array([1, 2, 3], type=ext_ty.storage_type)
ext_arr = pa.ExtensionArray.from_storage(ext_ty, arr)
batch = pa.RecordBatch.from_arrays([ext_arr], names=['ext'])
buf = ipc_write_batch(batch)
> with pytest.warns((RuntimeWarning, FutureWarning)):
E Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,
<class 'FutureWarning'>) were emitted.
E Emitted warnings: [].
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]