Kaydet (Commit) 20443f30 authored tarafından Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

#3650: fix a reference leak in bytes.split('x')

Actually the same as r65785, but trunk only has bytearray.
üst b6f9806b
...@@ -12,6 +12,8 @@ What's New in Python 3.0 release candidate 1 ...@@ -12,6 +12,8 @@ What's New in Python 3.0 release candidate 1
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #3650: Fixed a reference leak in bytes.split('x').
Library Library
------- -------
......
...@@ -1163,8 +1163,11 @@ string_split(PyBytesObject *self, PyObject *args) ...@@ -1163,8 +1163,11 @@ string_split(PyBytesObject *self, PyObject *args)
PyBuffer_Release(&vsub); PyBuffer_Release(&vsub);
return NULL; return NULL;
} }
else if (n == 1) else if (n == 1) {
return split_char(self, len, sub[0], maxsplit); list = split_char(self, len, sub[0], maxsplit);
PyBuffer_Release(&vsub);
return list;
}
list = PyList_New(PREALLOC_SIZE(maxsplit)); list = PyList_New(PREALLOC_SIZE(maxsplit));
if (list == NULL) { if (list == NULL) {
...@@ -1379,8 +1382,11 @@ string_rsplit(PyBytesObject *self, PyObject *args) ...@@ -1379,8 +1382,11 @@ string_rsplit(PyBytesObject *self, PyObject *args)
PyBuffer_Release(&vsub); PyBuffer_Release(&vsub);
return NULL; return NULL;
} }
else if (n == 1) else if (n == 1) {
return rsplit_char(self, len, sub[0], maxsplit); list = rsplit_char(self, len, sub[0], maxsplit);
PyBuffer_Release(&vsub);
return list;
}
list = PyList_New(PREALLOC_SIZE(maxsplit)); list = PyList_New(PREALLOC_SIZE(maxsplit));
if (list == NULL) { if (list == NULL) {
......
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