diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index 4f067d958b799..cd98087c06c18 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -65,6 +65,12 @@ def load_reduce(self) -> None: ("pandas.core.sparse.array", "SparseArray"): ("pandas.core.arrays", "SparseArray"), # 15477 ("pandas.core.base", "FrozenNDArray"): ("numpy", "ndarray"), + # Re-routing unpickle block logic to go through _unpickle_block instead + # for pandas <= 1.3.5 + ("pandas.core.internals.blocks", "new_block"): ( + "pandas._libs.internals", + "_unpickle_block", + ), ("pandas.core.indexes.frozen", "FrozenNDArray"): ("numpy", "ndarray"), ("pandas.core.base", "FrozenList"): ("pandas.core.indexes.frozen", "FrozenList"), # 10890 diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 1a05dc1258266..e5f7272ea5c39 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -2612,10 +2612,6 @@ def new_block( # - maybe_coerce_values already called/unnecessary klass = get_block_type(values.dtype) - # Old pandas (<=1.3.0) will call this function with placements - # that aren't necessarily BlockPlacements when unpickling - if not isinstance(placement, BlockPlacement): - placement = BlockPlacement(placement) return klass(values, ndim=ndim, placement=placement, refs=refs)