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
Forward references guarded by typing.TYPE_CHECKING raises warnings with Sphinx 1.8.0/1.8.1 #5480
Comments
…ble Forward references
…ble Forward references
Fix #5480: autodoc: unable to find type hints for unresolvable Forward references
Fixed by #5535. |
@tk0miya Thanks |
A note for future people who come across this - circular imports can still be an issue if using Their README suggests a solution - to import the module instead of the object you're using in the annotation. |
Additional note to future readers, |
Building the documentation that uses the
typing.TYPE_CHECKING
constant to break import cycles as suggested in the mypy docs here results in a Warning with 1.8.0/1 that was not raised with 1.7.9. I am trying to build the docs of our project that unfortunately has a circular reference of this type warning free.This is similar to #4072 but a new change with Sphinx 1.8.0 that does not relate to the use of the
sphinx-autodoc-typehints
extension.I believe that the output is functionally identical to 1.7.9 but now raises a warning that was silent before. Raising the warning is probably correct since the conditionally imported type annotation was never expanded correctly. I have not looked into pep563 style postponed evaluation
Procedure to reproduce the problem
Build html docs of the attached project with
make html
Error logs / results
A warning of an Ignored NameError is raised
Expected results
Build without warnings
Reproducible project / your project
The latest tip of https://github.com/jenshnielsen/sphinx_issue builds without warnings with
Sphinx 1.7.9 but produces Warning with 1.8.0/1. This is a slightly modified version of the code used
to reproduce #4072
Environment info
The text was updated successfully, but these errors were encountered: