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

Black moves same-block trailing comment inside expression wrapped with parentheses #3741

Open
cnpryer opened this issue Jun 21, 2023 · 0 comments
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. T: bug Something isn't working

Comments

@cnpryer
Copy link

cnpryer commented Jun 21, 2023

Describe the bug

black formats the following code improperly handling # Trailing same-block.

x = 1
# Leading comment
del (
    # First inner own-line
    x  # Trailing comment same-line
    # Trailing comment own-line last inner
)  # Trailing same-block
# Trailing own-line

Result

@@ -4,5 +4,6 @@ del (
     # First inner own-line
     x  # Trailing comment same-line
     # Trailing comment own-line last inner
-)  # Trailing same-block
-# Trailing own-line
\ No newline at end of file
+    # Trailing same-block
+)
+# Trailing own-line

Environment

black, 23.3.0 (compiled: yes)
Python (CPython) 3.11.3

MacOS 13.3.1

@cnpryer cnpryer added the T: bug Something isn't working label Jun 21, 2023
@JelleZijlstra JelleZijlstra added the F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants