summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index f5a0d2a..27f1f26 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -494,8 +494,10 @@ instance_setattr(inst, name, v)
object *v;
{
object *func, *args, *res;
- if (name[0] == '_' && name[1] == '_') {
- int n = strlen(name);
+ if (name[0] == '_' && name[1] == '_'
+ && (strcmp(name, "__dict__") == 0 ||
+ strcmp(name, "__class__") == 0)) {
+ int n = strlen(name);
if (name[n-1] == '_' && name[n-2] == '_') {
err_setstr(TypeError, "read-only special attribute");
return -1;