diff options
| author | Guido van Rossum <guido@python.org> | 1996-08-21 14:54:28 +0000 |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1996-08-21 14:54:28 +0000 |
| commit | de1cee2f2cd50056a1e6f8d7db77402e765ed3b7 (patch) | |
| tree | edf4db7fe4e6550b191193396f0b3424bda73b3f /Objects | |
| parent | 4f9ff840fe2bbd4085acb6d204ec17700eab5437 (diff) | |
| download | cpython-de1cee2f2cd50056a1e6f8d7db77402e765ed3b7.tar.gz | |
More efficient handling of "__doc__" lookup.
Diffstat (limited to 'Objects')
| -rw-r--r-- | Objects/classobject.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index d7be15a449..57768988cd 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -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) { |
