Sphinx automodule fails when a TypedDict contains a hyped
Describe the bug
Sphinx automodule fails when a TypedDict contains a hyped key
How to Reproduce
Try to use automodule on this file:
from typing import TypedDict
TestDict = TypedDict("TestDict", {"hello-world": str})
It fails with this error:
WARNING: don't know which module to import for autodocumenting 'Test::TestDict.hello-world' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)
This is valid Python, so it should pass
Environment Information
Please paste all output below into the bug report template text Platform: linux; (Linux-5.15.81-1-MANJARO-x86_64-with-glibc2.36) Python version: 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]) Python implementation: CPython Sphinx version: 5.3.0 Docutils version: 0.19 Jinja2 version: 3.1.2
Sphinx extensions
["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.napoleon"]
Additional context
No response
Any known workarounds? The TypedDicts for pyproject.toml fields contain a lot of hyphens! #10322 looks related.