mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#3650: fix a reference leak in bytes.split('x')
Actually the same as r65785, but trunk only has bytearray.
This commit is contained in:
parent
b6f9806bd6
commit
20443f3043
2 changed files with 12 additions and 4 deletions
|
@ -1163,8 +1163,11 @@ string_split(PyBytesObject *self, PyObject *args)
|
|||
PyBuffer_Release(&vsub);
|
||||
return NULL;
|
||||
}
|
||||
else if (n == 1)
|
||||
return split_char(self, len, sub[0], maxsplit);
|
||||
else if (n == 1) {
|
||||
list = split_char(self, len, sub[0], maxsplit);
|
||||
PyBuffer_Release(&vsub);
|
||||
return list;
|
||||
}
|
||||
|
||||
list = PyList_New(PREALLOC_SIZE(maxsplit));
|
||||
if (list == NULL) {
|
||||
|
@ -1379,8 +1382,11 @@ string_rsplit(PyBytesObject *self, PyObject *args)
|
|||
PyBuffer_Release(&vsub);
|
||||
return NULL;
|
||||
}
|
||||
else if (n == 1)
|
||||
return rsplit_char(self, len, sub[0], maxsplit);
|
||||
else if (n == 1) {
|
||||
list = rsplit_char(self, len, sub[0], maxsplit);
|
||||
PyBuffer_Release(&vsub);
|
||||
return list;
|
||||
}
|
||||
|
||||
list = PyList_New(PREALLOC_SIZE(maxsplit));
|
||||
if (list == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue