parsers._asciilower: use an explicit return object
authorSiddharth Agarwal <sid0@fb.com>
Wed, 01 Apr 2015 13:58:51 -0700
changeset 24575 a62e957413f7
parent 24574 e97a00bf18ae
child 24576 fe173106e7fe
parsers._asciilower: use an explicit return object No functional change, but this will make upcoming patches cleaner.
mercurial/parsers.c
--- 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)