Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop changing return type annotations to tuples (#2384)
This fixes a bug where a trailing comma would be added to a parenthesized return annotation changing its type to a tuple. Here's one case where this bug shows up: ``` def spam() -> ( this_is_a_long_type_annotation_which_should_NOT_get_a_trailing_comma ): pass ``` The root problem was that the type annotation was treated as if it was a parameter & import list (is_body=True to linegen::bracket_split_build_line) where a trailing comma is usually fine. Now there's another check in the aforementioned function to make sure the body it's operating on isn't a return annotation before truly adding a trailing comma.
- Loading branch information
Showing
4 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters