Kaydet (Commit) 1e7217de authored tarafından Georg Brandl's avatar Georg Brandl

Don't return the same object from trivial replace() cases --

it is guaranteed to return a new bytearray.
üst 17cb8a85
......@@ -1459,10 +1459,7 @@ done:
Py_LOCAL(PyByteArrayObject *)
return_self(PyByteArrayObject *self)
{
if (PyByteArray_CheckExact(self)) {
Py_INCREF(self);
return (PyByteArrayObject *)self;
}
/* always return a new bytearray */
return (PyByteArrayObject *)PyByteArray_FromStringAndSize(
PyByteArray_AS_STRING(self),
PyByteArray_GET_SIZE(self));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment