Mercurial > cpython-lru_cache-weakref
comparison Python/ceval.c @ 72558:6da962d77eb3
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.
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Fri, 30 Sep 2011 21:31:21 -0400 |
| parents | df6deb7bb772 |
| children | 07d27d865e2c |
comparison
equal
deleted
inserted
replaced
| 72557:17aba77fa99c | 72558:6da962d77eb3 |
|---|---|
| 1505 break; | 1505 break; |
| 1506 | 1506 |
| 1507 TARGET(BINARY_ADD) | 1507 TARGET(BINARY_ADD) |
| 1508 w = POP(); | 1508 w = POP(); |
| 1509 v = TOP(); | 1509 v = TOP(); |
| 1510 if (PyUnicode_Check(v) && PyUnicode_Check(w)) | 1510 x = PyNumber_Add(v, w); |
| 1511 x = PyUnicode_Concat(v, w); | |
| 1512 else | |
| 1513 x = PyNumber_Add(v, w); | |
| 1514 Py_DECREF(v); | 1511 Py_DECREF(v); |
| 1515 Py_DECREF(w); | 1512 Py_DECREF(w); |
| 1516 SET_TOP(x); | 1513 SET_TOP(x); |
| 1517 if (x != NULL) DISPATCH(); | 1514 if (x != NULL) DISPATCH(); |
| 1518 break; | 1515 break; |
| 1660 break; | 1657 break; |
| 1661 | 1658 |
| 1662 TARGET(INPLACE_ADD) | 1659 TARGET(INPLACE_ADD) |
| 1663 w = POP(); | 1660 w = POP(); |
| 1664 v = TOP(); | 1661 v = TOP(); |
| 1665 if (PyUnicode_Check(v) && PyUnicode_Check(w)) | 1662 x = PyNumber_InPlaceAdd(v, w); |
| 1666 x = PyUnicode_Concat(v, w); | |
| 1667 else | |
| 1668 x = PyNumber_InPlaceAdd(v, w); | |
| 1669 Py_DECREF(v); | 1663 Py_DECREF(v); |
| 1670 Py_DECREF(w); | 1664 Py_DECREF(w); |
| 1671 SET_TOP(x); | 1665 SET_TOP(x); |
| 1672 if (x != NULL) DISPATCH(); | 1666 if (x != NULL) DISPATCH(); |
| 1673 break; | 1667 break; |
