diff Modules/mathmodule.c @ 30683:3b59fa5d25b1 legacy-trunk

Simplify and speedup uses of Py_BuildValue(): * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
author Raymond Hettinger <python@rcn.com>
date Sun, 12 Oct 2003 19:09:37 +0000
parents e094a03a80ff
children b6c139544c16
line wrap: on
line diff
--- a/Modules/mathmodule.c	Sun Oct 12 18:24:34 2003 +0000
+++ b/Modules/mathmodule.c	Sun Oct 12 19:09:37 2003 +0000
@@ -259,23 +259,19 @@
 	if (base == NULL)
 		return loghelper(args, log, "d:log", arg);
 
-	newargs = PyTuple_New(1);
+	newargs = PyTuple_Pack(1, arg);
 	if (newargs == NULL)
 		return NULL;
-	Py_INCREF(arg);
-	PyTuple_SET_ITEM(newargs, 0, arg);
 	num = loghelper(newargs, log, "d:log", arg);
 	Py_DECREF(newargs);
 	if (num == NULL)
 		return NULL;
 
-	newargs = PyTuple_New(1);
+	newargs = PyTuple_Pack(1, base);
 	if (newargs == NULL) {
 		Py_DECREF(num);
 		return NULL;
 	}
-	Py_INCREF(base);
-	PyTuple_SET_ITEM(newargs, 0, base);
 	den = loghelper(newargs, log, "d:log", base);
 	Py_DECREF(newargs);
 	if (den == NULL) {