bpo-31993: Do not use memoryview when pickle large strings. (#5154) · pythoncapi/cpython@5b76bdb · GitHub
Skip to content

Commit 5b76bdb

Browse files
bpo-31993: Do not use memoryview when pickle large strings. (python#5154)
PyMemoryView_FromMemory() created a memoryview referring to the internal data of the string. When the string is destroyed the memoryview become referring to a freed memory.
1 parent f3031b8 commit 5b76bdb

3 files changed

Lines changed: 36 additions & 35 deletions

File tree

Lib/test/pickletester.py

Lines changed: 30 additions & 30 deletions

Misc/NEWS.d/3.7.0a4.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,9 @@ ctypes._aix.find_library() Patch by: Michael Felt
693693
.. nonce: -OMNg8
694694
.. section: Library
695695
696-
The picklers no longer allocate temporary memory when dumping large
697-
``bytes`` and ``str`` objects into a file object. Instead the data is
698-
directly streamed into the underlying file object.
696+
The pickler now uses less memory when serializing large bytes and str
697+
objects into a file. Pickles created with protocol 4 will require less
698+
memory for unpickling large bytes and str objects.
699699

700700
..
701701

Modules/_pickle.c

Lines changed: 3 additions & 2 deletions

0 commit comments

Comments
 (0)