diff options
author | Guido van Rossum <guido@python.org> | 1998-07-08 13:34:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-08 13:34:48 (GMT) |
commit | 7ba30431ec821ba00c833d451abe047a9ae60aba (patch) | |
tree | 5c359ea3e87a7df0aa181207d493543116659c5c /Objects | |
parent | b77a68e6b18e01ac7cf8a88b9b6356ea2f923af0 (diff) | |
download | cpython-7ba30431ec821ba00c833d451abe047a9ae60aba.zip cpython-7ba30431ec821ba00c833d451abe047a9ae60aba.tar.gz cpython-7ba30431ec821ba00c833d451abe047a9ae60aba.tar.bz2 |
Recompute the special getattr/setattr/delattr cache slots after
changing __dict__ *or* __bases__.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/classobject.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index f6fc5d8..2154299 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -227,21 +227,26 @@ set_slot(slot, v) Py_XDECREF(temp); } -static char * -set_dict(c, v) +static void +set_attr_slots(c) PyClassObject *c; - PyObject *v; { PyClassObject *dummy; - if (v == NULL || !PyDict_Check(v)) - return "__dict__ must be a dictionary object"; - set_slot(&c->cl_dict, v); - set_slot(&c->cl_getattr, class_lookup(c, getattrstr, &dummy)); set_slot(&c->cl_setattr, class_lookup(c, setattrstr, &dummy)); set_slot(&c->cl_delattr, class_lookup(c, delattrstr, &dummy)); +} +static char * +set_dict(c, v) + PyClassObject *c; + PyObject *v; +{ + if (v == NULL || !PyDict_Check(v)) + return "__dict__ must be a dictionary object"; + set_slot(&c->cl_dict, v); + set_attr_slots(c); return ""; } @@ -263,6 +268,7 @@ set_bases(c, v) return "a __bases__ item causes an inheritance cycle"; } set_slot(&c->cl_bases, v); + set_attr_slots(c); return ""; } |