-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Type hinting a return type as nullable renders None
#8603
Comments
It seems that there is a general issue with the |
Thank you for the analysis @ViRuSTriNiTy, we probably need to change the rendering to handle the |
…al bar character in annotation labels to ensure it is not treated as field separator of record-based nodes
…notation_label_of_return_type` with a variant for testing return type using syntax `X | Y`
@Pierre-Sassoulas Thanks for pointing me into the right direction. I think I found the line that produces the wrong output, already added some commits in my fork. It is caused by missing escape handling. The docs of the DOT language mention this requirement in section Record-based Nodes with
I will provide a PR to fix this. |
…ore" comment` pre-commit hook error
…e handling is now part of the printer as it is DOT language specific
…d diadefs and inspector tests to also cover nullable patterns
… hint as suggested in the review process
Bug description
Hi there,
the following code
produces
meaning
None
is not considered as part of the type hint. My current workaround is to revert back toOptional[T]
likewhich correctly produces
I think the handling for the new syntax for nullable is missing, which would explain why
Optional[T]
is working butT | None
is not.Configuration
Pylint output
Expected behavior
Type hint
T | None
is correctly handled likeOption[T]
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: