Skip to content

args[0]_obj bug

When number of 'Number of Inputs'/arguments more than 3

#include "py/runtime.h"

STATIC mp_obj_t my_function(size_t n_args, const mp_obj_t *args) {
    bool arg_1 = mp_obj_is_true(args[0]_obj);
    bool arg_2 = mp_obj_is_true(args[1]_obj);
    bool arg_3 = mp_obj_is_true(args[2]_obj);
    bool arg_4 = mp_obj_is_true(args[3]_obj);

    // Your code here!

args[0]_obj must be args[0] etc

#include "py/runtime.h"

STATIC mp_obj_t my_function(size_t n_args, const mp_obj_t *args) {
    bool arg_1 = mp_obj_is_true(args[0]);
    bool arg_2 = mp_obj_is_true(args[1]);
    bool arg_3 = mp_obj_is_true(args[2]);
    bool arg_4 = mp_obj_is_true(args[3]);

    // Your code here!

Thanks