mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +00:00
Use new exceptions.
This commit is contained in:
parent
97ff5308fe
commit
87e7ea72a6
8 changed files with 39 additions and 48 deletions
|
@ -103,7 +103,7 @@ getmember(addr, mlist, name)
|
|||
}
|
||||
}
|
||||
|
||||
err_setstr(NameError, name);
|
||||
err_setstr(AttributeError, name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ setmember(addr, mlist, name, v)
|
|||
for (l = mlist; l->name != NULL; l++) {
|
||||
if (strcmp(l->name, name) == 0) {
|
||||
if (l->readonly || l->type == T_STRING) {
|
||||
err_setstr(RuntimeError, "readonly attribute");
|
||||
err_setstr(TypeError, "readonly attribute");
|
||||
return -1;
|
||||
}
|
||||
addr += l->offset;
|
||||
|
@ -178,6 +178,6 @@ setmember(addr, mlist, name, v)
|
|||
}
|
||||
}
|
||||
|
||||
err_setstr(NameError, name);
|
||||
err_setstr(AttributeError, name);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue