Getting Function signature in CPython

Sorry for writing again, I did not manage to find out myself.
As mentioned in other post I am using embedded python and I am calling
python functions from within C .
I am able to call the function with
PyObject_CallObject(function, arguments)
But before calling i’d like to know if the arguments provided match to the function signature.
I’d like to know if i can expect an error before actually calling the function. How to get the Function signature in C-Python ? I have seen the inspect package, but this is not usable in Embedded python. is it ?

Thank you again for your answers.

What I have done in this situation is call a python wrapper function that I provide that can do the hard work before calling the target function.

Of course you could not bother with the signature checking at all and simple call the function with the args you expect to be correct.
Catch all errors and report any failures with context to help the developer/user fix the issue.

Given you must catch all errors and report failures anyway this maybe the pragmatic solution.

Just call it and see if you get an exception. There are all kinds of things that might go wrong, and matching up arguments to parameters is far too complex to reimplement prior to calling a function. Don’t forget, for example, that you might be calling a function that takes *args,**kwargs, and then passes that on to a wrapped function; sometimes you’ll have a __wrapped__ attribute that you can follow, but other times you won’t.

<Signature (obj, *, follow_wrapped=True, globals=None, locals=None, eval_str=False)>

frequently works.