Skip to content

Commit 5bf8fd3

Browse files
committed
Update the code to loop through params.values() instead of params itself, since parameters is a dictionary-like object. The earlier code tried to access .second on the iterator, which isn’t valid when working with dict values
Signed-off-by: Samaresh Kumar Singh <[email protected]>
1 parent 57f6b2a commit 5bf8fd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/python/src/global_optimization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ size_t num_function_arguments(py::object f, size_t expected_num)
5959

6060
// Check if function accepts *args (VAR_POSITIONAL)
6161
bool has_var_args = false;
62-
for (auto item : params) {
63-
auto param = item.second.cast<py::object>();
62+
for (auto item : params.attr("values")()) {
63+
auto param = item.cast<py::object>();
6464
auto kind = param.attr("kind");
6565
// inspect.Parameter.VAR_POSITIONAL == 2
6666
if (kind.cast<int>() == 2) {

0 commit comments

Comments
 (0)