Skip to content

Commit 6c8954a

Browse files
committed
runtime: Fixed PyBoundMethod::__call__ when args is null
1 parent 9e2e8c6 commit 6c8954a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/runtime/PyBoundMethod.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ PyResult<PyObject *> PyBoundMethod::__call__(PyTuple *args, PyDict *kwargs)
4343
{
4444
// first create new args tuple -> (self, *args)
4545
std::vector<Value> new_args_vector;
46-
new_args_vector.reserve(args->size() + 1);
46+
new_args_vector.reserve((args ? args->size() : 0) + 1);
4747
new_args_vector.push_back(m_self);
48-
for (const auto &arg : args->elements()) { new_args_vector.push_back(arg); }
48+
if (args) {
49+
for (const auto &arg : args->elements()) { new_args_vector.push_back(arg); }
50+
}
4951
auto args_ = PyTuple::create(new_args_vector);
5052
if (args_.is_err()) { return args_; }
5153
return m_method->call(args_.unwrap(), kwargs);

0 commit comments

Comments
 (0)