-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Avoid using keywords in TYPE_CHECKING
blocks.
#589
Conversation
If a keyword is used as a member name, replace it with `pass` and a comment.
Code within `TYPE_CHECKING` blocks are not executed at runtime, so they will not result in `NameError` or `AttributeError`. However, if method names or argument names use Python reserved words, or if the statements or expressions are incorrect in Python syntax, a `SyntaxError` will be raised. The newly added tests ensure that `typeannotator` avoids such situations: - If there are method names that match Python reserved words, `typeannotator` replaces them with `pass` and comments. - If there are argument names that match Python reserved words, `typeannotator` replaces them with `*args` or `**kwargs`. - If there are methods that specify required arguments after optional arguments, `typeannotator` replaces them with `**kwargs`. It was challenging to find a "real-world" COM library that covered all these cases. Therefore, in these tests, using `typedesc`s as a test double to simulate the results of parsing a COM type library. It has been confirmed through the discussions in the following issue that the changes made to the production code in commit 35f3336 prevent errors from occurring in a real COM library. enthought#588 (comment)
Thank you so much for your quick support @junkmd |
@junkmd I see that this fix is scheduled for the upcoming 1.4.6 release. Any idea of when this release will be published? |
I am planning to release As mentioned in this comment, |
That's great! Looking forward to the release :-) |
|
fixes #588