]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More efficient handling of "__doc__" lookup.
authorGuido van Rossum <guido@python.org>
Wed, 21 Aug 1996 14:54:28 +0000 (14:54 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 21 Aug 1996 14:54:28 +0000 (14:54 +0000)
Objects/classobject.c

index d7be15a449fa5d4ed8e07cc96701269aeb812d3d..57768988cd8b813ce14590ad59b5411f1d3920f2 100644 (file)
@@ -43,8 +43,14 @@ newclassobject(bases, dict, name)
 #endif
        classobject *op, *dummy;
        static object *getattrstr, *setattrstr, *delattrstr;
-       if (dictlookup(dict, "__doc__") == NULL) {
-               if (dictinsert(dict, "__doc__", None) < 0)
+       static object *docstr;
+       if (docstr == NULL) {
+               docstr= newstringobject("__doc__");
+               if (docstr == NULL)
+                       return NULL;
+       }
+       if (mappinglookup(dict, docstr) == NULL) {
+               if (mappinginsert(dict, docstr, None) < 0)
                        return NULL;
        }
        if (bases == NULL) {