Kaydet (Commit) b28911cd authored tarafından Guido van Rossum's avatar Guido van Rossum

added new.classobj()

üst c0fd1c0b
...@@ -144,6 +144,24 @@ new_module(unused, args) ...@@ -144,6 +144,24 @@ new_module(unused, args)
return newmoduleobject(name); return newmoduleobject(name);
} }
static char new_class_doc[] =
"Create a class object from (NAME, BASE_CLASSES, DICT).";
static object *
new_class(unused, args)
object* unused;
object* args;
{
object * name;
object * classes;
object * dict;
if (!newgetargs(args, "SO!O!", &name, &Tupletype, &classes,
&Mappingtype, &dict))
return NULL;
return newclassobject(classes, dict, name);
}
static struct methodlist new_methods[] = { static struct methodlist new_methods[] = {
{"instancemethod", new_instancemethod, 1, new_im_doc}, {"instancemethod", new_instancemethod, 1, new_im_doc},
#if 0 #if 0
...@@ -151,6 +169,7 @@ static struct methodlist new_methods[] = { ...@@ -151,6 +169,7 @@ static struct methodlist new_methods[] = {
#endif #endif
{"code", new_code, 1, new_code_doc}, {"code", new_code, 1, new_code_doc},
{"module", new_module, 1, new_module_doc}, {"module", new_module, 1, new_module_doc},
{"classobj", new_class, 1, new_class_doc},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment