summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 5b3de4d..f8cbea1 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -2184,8 +2184,9 @@ _Pickler_write_bytes(PicklerObject *self,
/* Stream write the payload into the file without going through the
output buffer. */
if (payload == NULL) {
- payload = mem = PyMemoryView_FromMemory((char *) data, data_size,
- PyBUF_READ);
+ /* TODO: It would be better to use a memoryview with a linked
+ original string if this is possible. */
+ payload = mem = PyBytes_FromStringAndSize(data, data_size);
if (payload == NULL) {
return -1;
}