micropython: add __argspec__ to function objects
Returns a tuple that is somewhat compatible to inspect.FullArgSpec():
- args: implemented
- varargs: implemented (either None or "args")
- varkw: implemented (either None or "kwargs")
- defaults: not implemented, always None (not too difficult tbh)
- kwonlyargs: implemented
- kwonlydefaults: not implemented, always None
- annotations: not implemented, always None
Inspired by mp_setup_code_state_helper() in bc.c which is the function that reads the prelude of the bytecode to prepare a function to be called, and also is the function that raises TypeError when you call it wrong.
MP_BC_PRELUDE_SIG_DECODE() and MP_BC_PRELUDE_SIZE_DECODE() are two macros that put a bunch of variables in your function, that's where all the n_*_args variables come from.