Fix bytes.__bytes__ to not truncate at a zero byte (GH-27902)

This commit is contained in:
Mark Dickinson 2021-08-23 15:24:12 +01:00 • committed by GitHub
parent 24b63c695a
commit ae5259171b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1701,7 +1701,7 @@ bytes___bytes___impl(PyBytesObject *self)
return (PyObject *)self;
}
else {
return PyBytes_FromString(self->ob_sval);
return PyBytes_FromStringAndSize(self->ob_sval, Py_SIZE(self));
}
}