mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-10 13:40:16 +00:00
Add check to restrict arguments
This commit is contained in:
parent
2c95dd47d5
commit
13f67c169b
@ -498,6 +498,7 @@ void init_builtins(VM* _vm) {
|
|||||||
// tp_str
|
// tp_str
|
||||||
_vm->bind_constructor<-1>(_vm->_t(VM::tp_str), [](VM* vm, ArgsView args) {
|
_vm->bind_constructor<-1>(_vm->_t(VM::tp_str), [](VM* vm, ArgsView args) {
|
||||||
if(args.size() == 1) return VAR(Str());
|
if(args.size() == 1) return VAR(Str());
|
||||||
|
if(args.size() > 2) vm->TypeError("str() takes at most 1 argument");
|
||||||
return vm->py_str(args[1]);
|
return vm->py_str(args[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user