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

Skip to content

Commit 14144fc

Browse files
committed
Added delattr()
1 parent cae027b commit 14144fc

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,21 @@ builtin_setattr(self, args)
637637
return None;
638638
}
639639

640+
static object *
641+
builtin_delattr(self, args)
642+
object *self;
643+
object *args;
644+
{
645+
object *v;
646+
object *name;
647+
if (!getargs(args, "(OS)", &v, &name))
648+
return NULL;
649+
if (setattro(v, name, (object *)NULL) != 0)
650+
return NULL;
651+
INCREF(None);
652+
return None;
653+
}
654+
640655
static object *
641656
builtin_hash(self, args)
642657
object *self;
@@ -1264,6 +1279,7 @@ static struct methodlist builtin_methods[] = {
12641279
{"cmp", builtin_cmp},
12651280
{"coerce", builtin_coerce},
12661281
{"compile", builtin_compile},
1282+
{"delattr", builtin_delattr},
12671283
{"dir", builtin_dir},
12681284
{"divmod", builtin_divmod},
12691285
{"eval", builtin_eval},

0 commit comments

Comments
 (0)