Skip to content
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

[stubgen] Nested classes in NamedTuples are not produced #15752

Open
sobolevn opened this issue Jul 23, 2023 · 0 comments · May be fixed by #15776
Open

[stubgen] Nested classes in NamedTuples are not produced #15752

sobolevn opened this issue Jul 23, 2023 · 0 comments · May be fixed by #15776
Assignees
Labels

Comments

@sobolevn
Copy link
Member

Consider this code:

from typing import NamedTuple

class A(NamedTuple):
    class B: ...

In runtime you can freely access it:

>>> from typing import NamedTuple
>>> 
>>> class A(NamedTuple):
...     class B: ...
... 
>>> A.B
<class '__main__.A.B'>

But, stubgen does ignore it:

» stubgen ex.py && bat out/ex.pyi
Processed 1 modules
Generated out/ex.pyi
───────┬───────────────────────────────────────────────────────────────────────────────────
       │ File: out/ex.pyi
───────┼───────────────────────────────────────────────────────────────────────────────────
   1from typing import NamedTuple
   23class A(NamedTuple): ...
───────┴───────────────────────────────────────────────────────────────────────────────────

This needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant