mirror of
https://github.com/python/cpython.git
synced 2025-11-17 09:30:10 +00:00
Added delattr()
This commit is contained in:
parent
cae027b298
commit
14144fcdfd
1 changed files with 16 additions and 0 deletions
|
|
@ -637,6 +637,21 @@ builtin_setattr(self, args)
|
||||||
return None;
|
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 *
|
static object *
|
||||||
builtin_hash(self, args)
|
builtin_hash(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
|
@ -1264,6 +1279,7 @@ static struct methodlist builtin_methods[] = {
|
||||||
{"cmp", builtin_cmp},
|
{"cmp", builtin_cmp},
|
||||||
{"coerce", builtin_coerce},
|
{"coerce", builtin_coerce},
|
||||||
{"compile", builtin_compile},
|
{"compile", builtin_compile},
|
||||||
|
{"delattr", builtin_delattr},
|
||||||
{"dir", builtin_dir},
|
{"dir", builtin_dir},
|
||||||
{"divmod", builtin_divmod},
|
{"divmod", builtin_divmod},
|
||||||
{"eval", builtin_eval},
|
{"eval", builtin_eval},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue