diff --git a/py-polars/polars/io/ipc/anonymous_scan.py b/py-polars/polars/io/ipc/anonymous_scan.py index 3a363969a9ff..db8cfc802a4b 100644 --- a/py-polars/polars/io/ipc/anonymous_scan.py +++ b/py-polars/polars/io/ipc/anonymous_scan.py @@ -5,7 +5,6 @@ import polars._reexport as pl import polars.io.ipc -from polars.dependencies import pickle from polars.io._utils import _prepare_file_arg if TYPE_CHECKING: @@ -17,13 +16,12 @@ def _scan_ipc_fsspec( storage_options: dict[str, object] | None = None, ) -> LazyFrame: func = partial(_scan_ipc_impl, source, storage_options=storage_options) - func_serialized = pickle.dumps(func) storage_options = storage_options or {} with _prepare_file_arg(source, **storage_options) as data: schema = polars.io.ipc.read_ipc_schema(data) - return pl.LazyFrame._scan_python_function(schema, func_serialized) + return pl.LazyFrame._scan_python_function(schema, func) def _scan_ipc_impl( # noqa: D417 diff --git a/py-polars/polars/io/parquet/anonymous_scan.py b/py-polars/polars/io/parquet/anonymous_scan.py index a47b805d6baa..1b698094d7bd 100644 --- a/py-polars/polars/io/parquet/anonymous_scan.py +++ b/py-polars/polars/io/parquet/anonymous_scan.py @@ -5,7 +5,6 @@ import polars._reexport as pl import polars.io.parquet -from polars.dependencies import pickle from polars.io._utils import _prepare_file_arg if TYPE_CHECKING: @@ -17,13 +16,12 @@ def _scan_parquet_fsspec( storage_options: dict[str, object] | None = None, ) -> LazyFrame: func = partial(_scan_parquet_impl, source, storage_options=storage_options) - func_serialized = pickle.dumps(func) storage_options = storage_options or {} with _prepare_file_arg(source, **storage_options) as data: schema = polars.io.parquet.read_parquet_schema(data) - return pl.LazyFrame._scan_python_function(schema, func_serialized) + return pl.LazyFrame._scan_python_function(schema, func) def _scan_parquet_impl( # noqa: D417