py_sensor.c code question

In py_sensor.c, there is a routine that is part of the initialization: py_sensor_skip_frames()

It starts off:

static mp_obj_t py_sensor_skip_frames(uint n_args, const mp_obj_t *args) {
int frames = (n_args == 1) ? mp_obj_get_int(args[0]) : 10; // OV Recommended.

I’m confused by this code -I’d submit a github pull request, but I’m afraid that I’m missing something obvious:

Isn’t n_args always at least equal to ‘1’ , and args[0] contains the name of the routine? If so, then mp_obj_get_int(args[0]) always fails.
Should this code instead be:

int frames = (n_args > 1) ? mp_obj_get_int(args[1]) : 10; // OV Recommended.

Cheers,
Bill

Args[0] isn’t the name of the routine. It’s the first argument.

Look at the code that calls these things. It’s buried somewhere in the MP py dir. The calling code uses slightly different call patterns given the situation.