diff 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
line wrap: on
line diff
--- a/Python/ceval.c	Sat Oct 01 03:09:58 2011 +0200
+++ b/Python/ceval.c	Fri Sep 30 21:31:21 2011 -0400
@@ -1507,10 +1507,7 @@
         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 @@
         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);