[New-bugs-announce] [issue39681] pickle.load expects an object that implements readinto

Nathan Goldbaum report at bugs.python.org
Tue Feb 18 20:04:49 EST 2020

New submission from Nathan Goldbaum <nathan12343 at gmail.com>:

As of https://github.com/python/cpython/pull/7076, it looks like at least the C implementation of pickle.load expects the file argument to implement readinto:


This is a change in behavior relative to previous versions of Python and I don't see it mentioned in PEP 574 or in the pull request so I'm not sure why it was changed.

This change breaks some PyTorch tests (see https://github.com/pytorch/pytorch/issues/32289) and, at least one PyTorch user, although I don't have full details there.

I can try to fix this on the PyTorch side but I first want to check that this was an intentional change on the Python side of things.

components: Library (Lib)
messages: 362242
nosy: Nathan.Goldbaum
priority: normal
severity: normal
status: open
title: pickle.load expects an object that implements readinto
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list