From: Guido van Rossum Date: Tue, 16 Aug 1994 22:13:47 +0000 (+0000) Subject: If an attribute is deleted, __setattr__ is called with 2 instead of 3 X-Git-Tag: v1.1~198 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91ab4a8353447f265a7559a4769ac5404bb0b157;p=thirdparty%2FPython%2Fcpython.git If an attribute is deleted, __setattr__ is called with 2 instead of 3 arguments (adding __delattr__ was deemed too much overhead) --- diff --git a/Objects/classobject.c b/Objects/classobject.c index b8b72e9fd94e..a05c0bf368d7 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -459,7 +459,11 @@ instance_setattr(inst, name, v) { object *ac; if (inst->in_setattr != NULL) { - object *args = mkvalue("(sO)", name, v); + object *args; + if (v == NULL) + args = mkvalue("(s)", name); + else + args = mkvalue("(sO)", name, v); if (args != NULL) { object *res = call_object(inst->in_setattr, args); DECREF(args);