black icon indicating copy to clipboard operation
black copied to clipboard

Fix 4399 `ASTSafetyError` on comment in return type annotation

Open dankrzeminski32 opened this issue 1 year ago • 0 comments

Description

Resolves #4399

Added an extra check before adding commas to the elements in the body of a bracket split.

The check ensures that there is more than just one non-comment item in the list of return elements. It only performs this check for a bracket split in return annotations as it's non-problematic for parameter annotations.

The extra comment was causing the ASTSafetyError (it led to the return type being interpreted as a tuple).

Checklist - did you ...

  • [x] Add an entry in CHANGES.md if necessary?
  • [x] Add / update tests if necessary?
  • [ ] Add new / update outdated documentation?

dankrzeminski32 avatar Sep 03 '24 16:09 dankrzeminski32