-
Notifications
You must be signed in to change notification settings - Fork 13
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
[FIX] Prevent signature symbol to break on TypeError #67
Conversation
Thanks @gcalmettes ! I am not very sure that this exception is a bug from Does |
Hi @smarie , Yes, Actually, using This won't raise a TypeError:
This will raise a TypeError:
|
I do not have a local fastapi environment, can you please confirm that |
I confirm indeed
|
Ok then. I think that we need to extend the scope here to catching general |
Co-authored-by: Sylvain Marié <sylvain.marie@schneider-electric.com>
Done, thanks ! |
Thanks @gcalmettes, I'll make a release now |
…l(repr(v))` raises an exception, created signatures would raise an exception instead of automatically protecting the symbol. PR #67
I created a test for future reference python-makefun/makefun/tests/test_issues.py Line 189 in 5090d44
This is now fixed in 1.11.3, released now. Thanks again @gcalmettes ! |
Thanks for your reactivity @smarie ! |
Hi,
First of all, thanks for
makefun
, very useful !I came into the situation where I had to modify the signature of a FastAPI endpoint having
Body(default="")
as default value for one of the parameter. Any value other than the empty string for the default value ofBody
would work, but somehow having an empty string leads to a TypeError in the checking for proctection need of the symbol.line 370, in _signature_symbol_needs_protection return eval(repr(symbol), evaldict) != symbol File "<string>", line 1, in <module> TypeError: Body() missing 1 required positional argument: 'default'
This PR fixes this by allowing the handling of TypeError in the
_signature_symbol_needs_protection
function.Minimal example of breaking code before the PR: