[Python-3000-checkins] r65985 - in python/branches/py3k: Misc/NEWS Objects/bytesobject.c

amaury.forgeotdarc python-3000-checkins at python.org
Sat Aug 23 00:05:21 CEST 2008


Author: amaury.forgeotdarc
Date: Sat Aug 23 00:05:20 2008
New Revision: 65985

Log:
#3650: fix a reference leak in bytes.split('x')
Actually the same as r65785, but trunk only has bytearray.


Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Objects/bytesobject.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Aug 23 00:05:20 2008
@@ -12,6 +12,8 @@
 Core and Builtins
 -----------------
 
+- Issue #3650: Fixed a reference leak in bytes.split('x').
+
 Library
 -------
 

Modified: python/branches/py3k/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k/Objects/bytesobject.c	(original)
+++ python/branches/py3k/Objects/bytesobject.c	Sat Aug 23 00:05:20 2008
@@ -1163,8 +1163,11 @@
 		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 @@
 		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) {


More information about the Python-3000-checkins mailing list