| 95 | dispatch[pickle.REDUCE[0]] = load_reduce # type: ignore[assignment] |
| 96 | |
| 97 | def load_newobj(self) -> None: |
| 98 | args = self.stack.pop() # type: ignore[attr-defined] |
| 99 | cls = self.stack.pop() # type: ignore[attr-defined] |
| 100 | |
| 101 | # compat |
| 102 | if issubclass(cls, DatetimeArray) and not args: |
| 103 | arr = np.array([], dtype="M8[ns]") |
| 104 | obj = cls.__new__(cls, arr, arr.dtype) |
| 105 | elif issubclass(cls, TimedeltaArray) and not args: |
| 106 | arr = np.array([], dtype="m8[ns]") |
| 107 | obj = cls.__new__(cls, arr, arr.dtype) |
| 108 | elif cls is BlockManager and not args: |
| 109 | obj = cls.__new__(cls, (), [], False) |
| 110 | else: |
| 111 | obj = cls.__new__(cls, *args) |
| 112 | self.append(obj) # type: ignore[attr-defined] |
| 113 | |
| 114 | dispatch[pickle.NEWOBJ[0]] = load_newobj # type: ignore[assignment] |
| 115 | |