]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added delattr()
authorGuido van Rossum <guido@python.org>
Mon, 29 Aug 1994 12:53:40 +0000 (12:53 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 29 Aug 1994 12:53:40 +0000 (12:53 +0000)
Python/bltinmodule.c

index fd983658225efae03f933be30db759b75f35efeb..67b7e26b840330e608a21fa31879c6f158704c50 100644 (file)
@@ -637,6 +637,21 @@ builtin_setattr(self, args)
        return None;
 }
 
+static object *
+builtin_delattr(self, args)
+       object *self;
+       object *args;
+{
+       object *v;
+       object *name;
+       if (!getargs(args, "(OS)", &v, &name))
+               return NULL;
+       if (setattro(v, name, (object *)NULL) != 0)
+               return NULL;
+       INCREF(None);
+       return None;
+}
+
 static object *
 builtin_hash(self, args)
        object *self;
@@ -1264,6 +1279,7 @@ static struct methodlist builtin_methods[] = {
        {"cmp",         builtin_cmp},
        {"coerce",      builtin_coerce},
        {"compile",     builtin_compile},
+       {"delattr",     builtin_delattr},
        {"dir",         builtin_dir},
        {"divmod",      builtin_divmod},
        {"eval",        builtin_eval},