Commit 0558eb95 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add param names for str.encode and decode

parent bb6a2076
...@@ -129,6 +129,9 @@ BoxedCode::BoxedCode(int num_args, bool takes_varargs, bool takes_kwargs, int fi ...@@ -129,6 +129,9 @@ BoxedCode::BoxedCode(int num_args, bool takes_varargs, bool takes_kwargs, int fi
num_args(num_args), num_args(num_args),
times_interpreted(0), times_interpreted(0),
internal_callable(NULL, NULL) { internal_callable(NULL, NULL) {
// If any param names are specified, make sure all of them are (to avoid common mistakes):
ASSERT(this->param_names.numNormalArgs() == 0 || this->param_names.numNormalArgs() == num_args, "%d %d",
this->param_names.numNormalArgs(), num_args);
} }
BoxedCode::BoxedCode(int num_args, bool takes_varargs, bool takes_kwargs, const char* name, const char* doc, BoxedCode::BoxedCode(int num_args, bool takes_varargs, bool takes_kwargs, const char* name, const char* doc,
......
...@@ -2741,12 +2741,14 @@ void setupStr() { ...@@ -2741,12 +2741,14 @@ void setupStr() {
str_cls->giveAttr("istitle", new BoxedFunction(BoxedCode::create((void*)strIsTitle, BOXED_BOOL, 1, "str.istitle"))); str_cls->giveAttr("istitle", new BoxedFunction(BoxedCode::create((void*)strIsTitle, BOXED_BOOL, 1, "str.istitle")));
str_cls->giveAttr("isupper", new BoxedFunction(BoxedCode::create((void*)strIsUpper, BOXED_BOOL, 1, "str.isupper"))); str_cls->giveAttr("isupper", new BoxedFunction(BoxedCode::create((void*)strIsUpper, BOXED_BOOL, 1, "str.isupper")));
str_cls->giveAttr( str_cls->giveAttr("decode",
"decode", new BoxedFunction(BoxedCode::create((void*)strDecode, UNKNOWN, 3, false, false, "str.decode", "",
new BoxedFunction(BoxedCode::create((void*)strDecode, UNKNOWN, 3, false, false, "str.decode"), { 0, 0 })); ParamNames({ "", "encoding", "errors" }, NULL, NULL)),
str_cls->giveAttr( { 0, 0 }));
"encode", str_cls->giveAttr("encode",
new BoxedFunction(BoxedCode::create((void*)strEncode, UNKNOWN, 3, false, false, "str.encode"), { 0, 0 })); new BoxedFunction(BoxedCode::create((void*)strEncode, UNKNOWN, 3, false, false, "str.encode", "",
ParamNames({ "", "encoding", "errors" }, NULL, NULL)),
{ 0, 0 }));
str_cls->giveAttr("lower", new BoxedFunction(BoxedCode::create((void*)strLower, STR, 1, "str.lower"))); str_cls->giveAttr("lower", new BoxedFunction(BoxedCode::create((void*)strLower, STR, 1, "str.lower")));
str_cls->giveAttr("swapcase", new BoxedFunction(BoxedCode::create((void*)strSwapcase, STR, 1, "str.swapcase"))); str_cls->giveAttr("swapcase", new BoxedFunction(BoxedCode::create((void*)strSwapcase, STR, 1, "str.swapcase")));
......
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