]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use getstringsize where available instead of strlen.
authorGuido van Rossum <guido@python.org>
Mon, 26 Aug 1996 14:58:03 +0000 (14:58 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 26 Aug 1996 14:58:03 +0000 (14:58 +0000)
Objects/classobject.c

index 191b5568c0e13c014ea5f452461424afb479d01d..9b12d1876a836b94d9ec8d636e6e5d2c206d7462 100644 (file)
@@ -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;