[Python-checkins] r68359 - python/branches/py3k/Python/bltinmodule.c

raymond.hettinger python-checkins at python.org
Tue Jan 6 10:37:13 CET 2009


Author: raymond.hettinger
Date: Tue Jan  6 10:37:13 2009
New Revision: 68359

Log:
Mini-optimization: use pack/unpack functions for argument tuples.

Modified:
   python/branches/py3k/Python/bltinmodule.c

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Tue Jan  6 10:37:13 2009
@@ -112,7 +112,7 @@
 		ns = PyDict_New();
 	}
 	else {
-		PyObject *pargs = Py_BuildValue("OO", name, bases);
+		PyObject *pargs = PyTuple_Pack(2, name, bases);
 		if (pargs == NULL) {
 			Py_DECREF(prep);
 			Py_DECREF(meta);
@@ -133,7 +133,7 @@
 	cell = PyObject_CallFunctionObjArgs(func, ns, NULL);
 	if (cell != NULL) {
 		PyObject *margs;
-		margs = Py_BuildValue("OOO", name, bases, ns);
+		margs = PyTuple_Pack(3, name, bases, ns);
 		if (margs != NULL) {
 			cls = PyEval_CallObjectWithKeywords(meta, margs, mkw);
 			Py_DECREF(margs);
@@ -754,7 +754,7 @@
 	PyObject *prog, *globals = Py_None, *locals = Py_None;
 	int plain = 0;
 
-	if (!PyArg_ParseTuple(args, "O|OO:exec", &prog, &globals, &locals))
+	if (!PyArg_UnpackTuple(args, "exec", 1, 3, &prog, &globals, &locals))
 		return NULL;
 	
 	if (globals == Py_None) {


More information about the Python-checkins mailing list