Skip to content

Write pickle to file-like without intermediate in-memory buffer #37056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 14, 2020
Merged
2 changes: 1 addition & 1 deletion pandas/io/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def to_pickle(
if protocol < 0:
protocol = pickle.HIGHEST_PROTOCOL
try:
f.write(pickle.dumps(obj, protocol=protocol))
pickle.dump(obj, f, protocol=protocol)
finally:
if f != filepath_or_buffer:
# do not close user-provided file objects GH 35679
Expand Down