diff options
author | Collin Winter <collinw@gmail.com> | 2009-02-20 19:30:41 +0000 |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2009-02-20 19:30:41 +0000 |
commit | 8725dce2ae77aeac72cdfa024a1d0aff897a6f56 (patch) | |
tree | 5892f3888692f84d6f92435080b5249ef6a4887d /Python/ceval.c | |
parent | e9fb6863da50d843ad3e26f81b807320be385adc (diff) | |
download | cpython-git-8725dce2ae77aeac72cdfa024a1d0aff897a6f56.tar.gz |
Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d457fd5489..419ecfaaaa 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1283,7 +1283,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case BINARY_MODULO: w = POP(); v = TOP(); - x = PyNumber_Remainder(v, w); + if (PyString_CheckExact(v)) + x = PyString_Format(v, w); + else + x = PyNumber_Remainder(v, w); Py_DECREF(v); Py_DECREF(w); SET_TOP(x); |