Commit d27dfe64 authored by Guido van Rossum's avatar Guido van Rossum

Only __dict__ and __class__ are read-only instance attributes

parent 6ea77527
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment