mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
remove "fast-path" for (i)adding strings
These were just an artifact of the old unicode concatenation hack and likely just penalized other kinds of adding. Also, this fixes __(i)add__ on string subclasses.
This commit is contained in:
parent
c759f3e7ec
commit
811c2f1369
2 changed files with 14 additions and 8 deletions
|
@ -1507,10 +1507,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
TARGET(BINARY_ADD)
|
||||
w = POP();
|
||||
v = TOP();
|
||||
if (PyUnicode_Check(v) && PyUnicode_Check(w))
|
||||
x = PyUnicode_Concat(v, w);
|
||||
else
|
||||
x = PyNumber_Add(v, w);
|
||||
x = PyNumber_Add(v, w);
|
||||
Py_DECREF(v);
|
||||
Py_DECREF(w);
|
||||
SET_TOP(x);
|
||||
|
@ -1662,10 +1659,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
TARGET(INPLACE_ADD)
|
||||
w = POP();
|
||||
v = TOP();
|
||||
if (PyUnicode_Check(v) && PyUnicode_Check(w))
|
||||
x = PyUnicode_Concat(v, w);
|
||||
else
|
||||
x = PyNumber_InPlaceAdd(v, w);
|
||||
x = PyNumber_InPlaceAdd(v, w);
|
||||
Py_DECREF(v);
|
||||
Py_DECREF(w);
|
||||
SET_TOP(x);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue