[Python-checkins] cpython: simply this slightly

benjamin.peterson python-checkins at python.org
Sat Mar 17 02:16:16 CET 2012


http://hg.python.org/cpython/rev/1bb05dd557b1
changeset:   75761:1bb05dd557b1
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Mar 16 20:15:54 2012 -0500
summary:
  simply this slightly

files:
  Objects/typeobject.c |  15 ++++++---------
  1 files changed, 6 insertions(+), 9 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2949,13 +2949,13 @@
         return NULL;
 
     if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) {
-        static PyObject *comma = NULL;
         PyObject *abstract_methods = NULL;
         PyObject *builtins;
         PyObject *sorted;
         PyObject *sorted_methods = NULL;
         PyObject *joined = NULL;
-        _Py_IDENTIFIER(join);
+        PyObject *comma;
+        _Py_static_string(comma_id, ", ");
 
         /* Compute ", ".join(sorted(type.__abstractmethods__))
            into joined. */
@@ -2973,13 +2973,10 @@
                                                       NULL);
         if (sorted_methods == NULL)
             goto error;
-        if (comma == NULL) {
-            comma = PyUnicode_InternFromString(", ");
-            if (comma == NULL)
-                goto error;
-        }
-        joined = _PyObject_CallMethodId(comma, &PyId_join,
-                                     "O",  sorted_methods);
+        comma = _PyUnicode_FromId(&comma_id);
+        if (comma == NULL)
+            goto error;
+        joined = PyUnicode_Join(comma, sorted_methods);
         if (joined == NULL)
             goto error;
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list