changeset 24575:a62e957413f7

parsers._asciilower: use an explicit return object No functional change, but this will make upcoming patches cleaner.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 01 Apr 2015 13:58:51 -0700
parents e97a00bf18ae
children fe173106e7fe
files mercurial/parsers.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Tue Mar 31 10:25:29 2015 -0700
+++ b/mercurial/parsers.c	Wed Apr 01 13:58:51 2015 -0700
@@ -98,6 +98,7 @@
 	char *str, *newstr;
 	Py_ssize_t i, len;
 	PyObject *newobj = NULL;
+	PyObject *ret = NULL;
 
 	str = PyBytes_AS_STRING(str_obj);
 	len = PyBytes_GET_SIZE(str_obj);
@@ -121,10 +122,11 @@
 		newstr[i] = lowertable[(unsigned char)c];
 	}
 
-	return newobj;
+	ret = newobj;
+	Py_INCREF(ret);
 quit:
 	Py_XDECREF(newobj);
-	return NULL;
+	return ret;
 }
 
 static PyObject *asciilower(PyObject *self, PyObject *args)