mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Use getstringsize where available instead of strlen.
This commit is contained in:
parent
dd6798c691
commit
e5920bc4c6
1 changed files with 1 additions and 1 deletions
|
@ -550,7 +550,7 @@ instance_setattr(inst, name, v)
|
|||
if (sname[0] == '_' && sname[1] == '_'
|
||||
&& (strcmp(sname, "__dict__") == 0 ||
|
||||
strcmp(sname, "__class__") == 0)) {
|
||||
int n = strlen(sname);
|
||||
int n = getstringsize(name);
|
||||
if (sname[n-1] == '_' && sname[n-2] == '_') {
|
||||
err_setstr(TypeError, "read-only special attribute");
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue