Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.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 | a8f04cbf659c |
| children | 2d98710f272e |
line wrap: on
line diff
--- a/Python/bltinmodule.c Sun Oct 12 18:24:34 2003 +0000 +++ b/Python/bltinmodule.c Sun Oct 12 19:09:37 2003 +0000 @@ -323,7 +323,7 @@ return NULL; if (PyNumber_Coerce(&v, &w) < 0) return NULL; - res = Py_BuildValue("(OO)", v, w); + res = PyTuple_Pack(2, v, w); Py_DECREF(v); Py_DECREF(w); return res; @@ -2185,7 +2185,7 @@ good = item; } else { - PyObject *arg = Py_BuildValue("(O)", item); + PyObject *arg = PyTuple_Pack(1, item); if (arg == NULL) { Py_DECREF(item); goto Fail_1; @@ -2252,7 +2252,7 @@ ok = 1; } else { PyObject *arg, *good; - arg = Py_BuildValue("(O)", item); + arg = PyTuple_Pack(1, item); if (arg == NULL) { Py_DECREF(item); goto Fail_1; @@ -2346,7 +2346,7 @@ if (func == Py_None) { ok = 1; } else { - arg = Py_BuildValue("(O)", item); + arg = PyTuple_Pack(1, item); if (arg == NULL) { Py_DECREF(item); goto Fail_1;
