summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-21 14:54:28 (GMT)
committerGuido van Rossum <guido@python.org>1996-08-21 14:54:28 (GMT)
commit019f424a0a88e97e3df2e83ea6b66aa50943702f (patch)
treea1b33e35be8a99578f6e4215e496c6076e0bd0ad /Objects
parentf1d74134450190f66b993319d067c9c4a75352be (diff)
downloadcpython-019f424a0a88e97e3df2e83ea6b66aa50943702f.zip
cpython-019f424a0a88e97e3df2e83ea6b66aa50943702f.tar.gz
cpython-019f424a0a88e97e3df2e83ea6b66aa50943702f.tar.bz2
More efficient handling of "__doc__" lookup.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index d7be15a..5776898 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) {