-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use inspect instead of f.__code__ #538
Comments
My concrete case is about abstracting common behaviour across multiple RPC methods. Especially the case where some common pre-processing has to be done to structures that are then used inside the methods. Though I must say I'm still under the humble impression that the proposed patch in #539 is a slight improvement: this way only people that use the "broken" python2 are forced to install the |
They are designed for this exact purpose: doing preprocessing before running the main method. Authorization checks, data sanitization, etc.
Well... ok you got a point. I'm swamped by work at $DAYJOB atm but I'll try to find the time to review it. |
Hi there,
Currently the
decorator._produce_input_message
function uses "home-grown" introspection viaf.__code__.(...)
to get the parameters of the method being wrapped.This doesn't work if the method has some other decorator, because the introspection tries to find the arguments of the decorator, instead of the decorated method.
Here's a simple example:
Using
inspect.signature(f)
instead of readingf.__code__
might be a nice way to work around this problem.The text was updated successfully, but these errors were encountered: