Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91ab4a8

Browse files
committed
If an attribute is deleted, __setattr__ is called with 2 instead of 3
arguments (adding __delattr__ was deemed too much overhead)
1 parent fda5fb2 commit 91ab4a8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Objects/classobject.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ instance_setattr(inst, name, v)
459459
{
460460
object *ac;
461461
if (inst->in_setattr != NULL) {
462-
object *args = mkvalue("(sO)", name, v);
462+
object *args;
463+
if (v == NULL)
464+
args = mkvalue("(s)", name);
465+
else
466+
args = mkvalue("(sO)", name, v);
463467
if (args != NULL) {
464468
object *res = call_object(inst->in_setattr, args);
465469
DECREF(args);

0 commit comments

Comments
 (0)