-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Failure to generate function signature #3726
Comments
Thank you for reporting. It would be very nice if anybody provides the reproducible example. Then I will patch the code with testcase. |
Any updates? If none, I can't merge this... |
The solution from stack overflow seems sensible...:
introspected_hints = (typing.get_type_hints(function)
if typing and hasattr(function, '__code__')`
try:
introspected_hints = (typing.get_type_hints(function)
if typing and hasattr(function, '__code__')
except AttributeError:
introspected_hints = {}
|
No, I'd like to know how to raise the error. I need some example to reproduce the bug before merging it. |
Any updates? I think this is good fix, so I'd like to merge this. To do that, I need reproducible example. |
I marked this as "help wanted". Please let me know how to reproduce the problem. |
Fixed. |
Sphinx (version 1.5.2) fails to generate function signature in case there are typing problems.
Problem
http://stackoverflow.com/questions/37362351/sphinx-does-not-produce-function-signature contains a good description of the problem (which also happens for me). It seems that if the typing module chokes on some code, sphinx will therefore fail to generate any signature for the affected function. In my specific case (Python 3.6, mypy 0.501), the code actually passes
mypy
(with the occasional# type: ignore
comment), but I still get theWARNING: error while formatting arguments for ...: ... object has no attribute ...
.Expected results
Sphinx should generate a function signature regardless of spurious failures of the typing module; the solution suggested in http://stackoverflow.com/questions/37362351/sphinx-does-not-produce-function-signature makes sense.
Reproducible project / your project
I haven't isolated the offending code out of my project - if/when I'll upload the project to Github, I'll add a link to it (this may take a while - my company intends to release it, but for now it is an internal project).
Environment info
The text was updated successfully, but these errors were encountered: