mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
re-enable new.code(...) with new args
This commit is contained in:
parent
64b24fb062
commit
896fc7ed4a
1 changed files with 18 additions and 3 deletions
|
|
@ -91,28 +91,43 @@ new_function(unused, args)
|
||||||
|
|
||||||
return (object *)newfunc;
|
return (object *)newfunc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static char new_code_doc[] =
|
static char new_code_doc[] =
|
||||||
"Create a code object from (CODESTRING, CONSTANTS, NAMES, FILENAME, NAME).";
|
"Create a code object from (ARGCOUNT, NLOCALS, FLAGS, CODESTRING, CONSTANTS, NAMES, VARNAMES, FILENAME, NAME).";
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
new_code(unused, args)
|
new_code(unused, args)
|
||||||
object* unused;
|
object* unused;
|
||||||
object* args;
|
object* args;
|
||||||
{
|
{
|
||||||
|
int argcount;
|
||||||
|
int nlocals;
|
||||||
|
int flags;
|
||||||
object* code;
|
object* code;
|
||||||
object* consts;
|
object* consts;
|
||||||
object* names;
|
object* names;
|
||||||
|
object* varnames;
|
||||||
object* filename;
|
object* filename;
|
||||||
object* name;
|
object* name;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!newgetargs(args, "SO!O!SS",
|
if (!newgetargs(args, "SO!O!SS",
|
||||||
&code, &Tupletype, &consts, &Tupletype, &names,
|
&code, &Tupletype, &consts, &Tupletype, &names,
|
||||||
&filename, &name))
|
&filename, &name))
|
||||||
return NULL;
|
return NULL;
|
||||||
return (object *)newcodeobject(code, consts, names, filename, name);
|
return (object *)newcodeobject(code, consts, names, filename, name);
|
||||||
}
|
#else
|
||||||
|
if (!newgetargs(args, "iiiSO!O!O!SS",
|
||||||
|
&argcount, &nlocals, &flags, /* These are new */
|
||||||
|
&code, &Tupletype, &consts, &Tupletype, &names,
|
||||||
|
&Tupletype, &varnames, /* These are new */
|
||||||
|
&filename, &name))
|
||||||
|
return NULL;
|
||||||
|
return (object *)newcodeobject(argcount, nlocals, flags,
|
||||||
|
code, consts, names, varnames, filename, name);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static char new_module_doc[] =
|
static char new_module_doc[] =
|
||||||
"Create a module object from (NAME).";
|
"Create a module object from (NAME).";
|
||||||
|
|
@ -133,8 +148,8 @@ static struct methodlist new_methods[] = {
|
||||||
{"instancemethod", new_instancemethod, 1, new_im_doc},
|
{"instancemethod", new_instancemethod, 1, new_im_doc},
|
||||||
#if 0
|
#if 0
|
||||||
{"function", new_function, 1, new_function_doc},
|
{"function", new_function, 1, new_function_doc},
|
||||||
{"code", new_code, 1, new_code_doc},
|
|
||||||
#endif
|
#endif
|
||||||
|
{"code", new_code, 1, new_code_doc},
|
||||||
{"module", new_module, 1, new_module_doc},
|
{"module", new_module, 1, new_module_doc},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue