mirror of https://github.com/python/cpython.git
[3.13] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) (#126495)
gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485)
Handle _Unpickler_SetStringInput() failure.
(cherry picked from commit a1c57bcfd2
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
6e9da38866
commit
83827ad819
|
@ -1287,6 +1287,10 @@ _Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
|
|||
else {
|
||||
read_size = _Unpickler_SetStringInput(self, data);
|
||||
Py_DECREF(data);
|
||||
if (read_size < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
self->prefetched_idx = 0;
|
||||
if (n <= read_size)
|
||||
return n;
|
||||
|
|
Loading…
Reference in New Issue