-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
autodoc isn't able to resolve struct.Struct type annotations #8315
Comments
Unfortunately, the
Note: In python3.9, it returns the correct module-info. But it answers the internal module name:
So it would better to use
Then, it working fine. |
…notation The builtin module, ``struct.Struct`` does not have correct module name since Python 3.8. This allows to refer it automatically.
I think it is not good to do a workaround because of a bug of pythons. I think it's better to add a workaround to Sphinx side. Then, nobody will do it on each project. #8627 will resolve this automatically. |
Fix #8315: autodoc: Failed to resolve struct.Struct type annotation
Describe the bug
If
struct.Struct
is declared in any type annotations, I getclass reference target not found: Struct
To Reproduce
Simple
index.rst
Simple
helloworld.py
Command line:
Expected behavior
If you comment out the 2 functions that have
Struct
type annotations, you'll see thatpathlib.Path
resolves fine and shows up in the resulting documentation. I'd expect thatStruct
would also resolve correctly.Your project
n/a
Screenshots
n/a
Environment info
'sphinx.ext.autosectionlabel',
'sphinx.ext.intersphinx',
'sphinx.ext.doctest',
'sphinx.ext.todo'
Additional context
The text was updated successfully, but these errors were encountered: