mirror of
https://github.com/python/cpython.git
synced 2025-11-07 17:12:03 +00:00
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6363)
This commit is contained in:
parent
629338f140
commit
c869529ea9
3 changed files with 22 additions and 19 deletions
|
|
@ -2781,8 +2781,9 @@ def test_clear_pickler_memo(self):
|
||||||
# object again, the third serialized form should be identical to the
|
# object again, the third serialized form should be identical to the
|
||||||
# first one we obtained.
|
# first one we obtained.
|
||||||
data = ["abcdefg", "abcdefg", 44]
|
data = ["abcdefg", "abcdefg", 44]
|
||||||
|
for proto in protocols:
|
||||||
f = io.BytesIO()
|
f = io.BytesIO()
|
||||||
pickler = self.pickler_class(f)
|
pickler = self.pickler_class(f, proto)
|
||||||
|
|
||||||
pickler.dump(data)
|
pickler.dump(data)
|
||||||
first_pickled = f.getvalue()
|
first_pickled = f.getvalue()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
End framing at the end of C implementation of :func:`pickle.Pickler.dump`.
|
||||||
|
|
@ -4152,9 +4152,10 @@ dump(PicklerObject *self, PyObject *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save(self, obj, 0) < 0 ||
|
if (save(self, obj, 0) < 0 ||
|
||||||
_Pickler_Write(self, &stop_op, 1) < 0)
|
_Pickler_Write(self, &stop_op, 1) < 0 ||
|
||||||
|
_Pickler_CommitFrame(self) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
self->framing = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue