File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,18 @@ def round_trip_pickle(
6161 # Only join tmpdir with _path when _path is a string or Path-like.
6262 # _path may be a ReadPickleBuffer (file-like) in which case it
6363 # should be used directly for pickle operations.
64- temp_path : pathlib .Path | ReadPickleBuffer
6564 if isinstance (_path , (str , pathlib .Path )):
66- temp_path = pathlib .Path (tmpdir ) / _path
65+ temp_path : FilePath = pathlib .Path (tmpdir ) / _path
66+ pd .to_pickle (obj , temp_path )
6767 else :
68- temp_path = _path
69- pd .to_pickle (obj , temp_path )
70- return pd .read_pickle (temp_path )
68+ # _path is a ReadPickleBuffer (file-like object)
69+ pd .to_pickle (obj , _path ) # type: ignore[arg-type]
70+
71+ # For read_pickle, handle both cases
72+ if isinstance (_path , (str , pathlib .Path )):
73+ return pd .read_pickle (pathlib .Path (tmpdir ) / _path )
74+ else :
75+ return pd .read_pickle (_path )
7176
7277
7378def round_trip_pathlib (writer , reader , path : str | None = None ):
You can’t perform that action at this time.
0 commit comments