Add check to restrict arguments

This commit is contained in:
faze-geek 2024-03-12 18:01:11 +05:30
parent 2c95dd47d5
commit 13f67c169b

View File

@ -498,6 +498,7 @@ void init_builtins(VM* _vm) {
// tp_str
_vm->bind_constructor<-1>(_vm->_t(VM::tp_str), [](VM* vm, ArgsView args) {
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]);
});