mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Don't return the same object from trivial replace() cases --
it is guaranteed to return a new bytearray.
This commit is contained in:
parent
17cb8a85d4
commit
1e7217de49
1 changed files with 1 additions and 4 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue