Showing the changes to python/lib (1 of 1 file). Show all
Unified · Split
| @@ -462,22 +462,26 @@ Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) · 461 unmodified lines | ||
| 462 | 462 | // {shortname} setters |
| 463 | 463 | """.format(**self.__dict__) |
| 464 | 464 | for set_param in self.prototypes['set']: |
| 465 | − params = get_params_types_names(set_param)[1] | |
| 466 | − paramtype = params['type'] | |
| 465 | + params = get_params_types_names(set_param)[1:] | |
| 466 | + param = self.shortname.split('_set_')[-1] | |
| 467 | + paramdecls = "".join([""" | |
| 468 | + {0} {1};""".format(p['type'], p['name']) for p in params]) | |
| 467 | 469 | method_name = get_name(set_param) |
| 468 | 470 | param = method_name.split('aubio_'+self.shortname+'_set_')[-1] |
| 469 | − pyparamtype = pyargparse_chars[paramtype] | |
| 471 | + refs = ", ".join(["&%s" % p['name'] for p in params]) | |
| 472 | + paramlist = ", ".join(["%s" % p['name'] for p in params]) | |
| 473 | + pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) | |
| 470 | 474 | out += """ |
| 471 | 475 | static PyObject * |
| 472 | 476 | Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) |
| 473 | 477 | {{ |
| 474 | 478 | uint_t err = 0; |
| 475 | − {paramtype} {param}; | |
| 479 | + {paramdecls} | |
| 476 | 480 | |
| 477 | − if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{ | |
| 481 | + if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ | |
| 478 | 482 | return NULL; |
| 479 | 483 | }} |
| 480 | − err = aubio_{shortname}_set_{param} (self->o, {param}); | |
| 484 | + err = aubio_{shortname}_set_{param} (self->o, {paramlist}); | |
| 481 | 485 | |
| 482 | 486 | if (err > 0) {{ |
| 483 | 487 | if (PyErr_Occurred() == NULL) {{ |
| @@ -492,7 +496,8 @@ Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) · 8 unmodified lines | ||
| 492 | 496 | }} |
| 493 | 497 | Py_RETURN_NONE; |
| 494 | 498 | }} |
| 495 | −""".format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) | |
| 499 | +""".format(param = param, refs = refs, paramdecls = paramdecls, | |
| 500 | + pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__) | |
| 496 | 501 | return out |
| 497 | 502 | |
| 498 | 503 | def gen_get(self): |