Mercurial > cpython-lru_cache-weakref
diff Modules/mathmodule.c @ 26818:e094a03a80ff legacy-trunk
SF patch #659536: Use PyArg_UnpackTuple where possible.
Obtain cleaner coding and a system wide
performance boost by using the fast, pre-parsed
PyArg_Unpack function instead of PyArg_ParseTuple
function which is driven by a format string.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Sun, 29 Dec 2002 16:33:45 +0000 |
| parents | b12e326b4ea2 |
| children | 3b59fa5d25b1 |
line wrap: on
line diff
--- a/Modules/mathmodule.c Sun Dec 29 05:49:09 2002 +0000 +++ b/Modules/mathmodule.c Sun Dec 29 16:33:45 2002 +0000 @@ -254,7 +254,7 @@ PyObject *ans; PyObject *newargs; - if (! PyArg_ParseTuple(args, "O|O:log", &arg, &base)) + if (!PyArg_UnpackTuple(args, "log", 1, 2, &arg, &base)) return NULL; if (base == NULL) return loghelper(args, log, "d:log", arg); @@ -298,7 +298,7 @@ { PyObject *arg; - if (! PyArg_ParseTuple(args, "O:log10", &arg)) + if (!PyArg_UnpackTuple(args, "log10", 1, 1, &arg)) return NULL; return loghelper(args, log10, "d:log10", arg); }
