mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
This commit is contained in:
parent
e9fb6863da
commit
8725dce2ae
2 changed files with 10 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue