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

Unstable formatting on multiline string with parens. #954

Closed
adamfaulkner opened this issue Aug 1, 2019 · 3 comments
Closed

Unstable formatting on multiline string with parens. #954

adamfaulkner opened this issue Aug 1, 2019 · 3 comments
Labels
T: bug Something isn't working

Comments

@adamfaulkner
Copy link

Operating system: Linux, ubuntu 19.04
Python version: 3.7.3
Black version: 19.0b3
Does also happen on master: yes

This exhibits unstable formatting. I wasn't able to find a more minimal test case.

def foo(argument):
            foo = ("""
a""").format(argument)
error: cannot format /tmp/test.py: INTERNAL ERROR: Black produced different code on the second pass of the formatter.  Please report a bug on https://github.com/psf/black/issues.  This diff might be helpful: /tmp/blk_t1e4zs2e.log

blk_t1e4zs2e.log

@msullivan
Copy link
Contributor

Another test case for likely the same issue:

details = ("""%s
              %s
           """) % (a, b)

@zsol zsol added C: unstable formatting Formatting changed on the second pass T: bug Something isn't working labels Sep 4, 2019
@ichard26 ichard26 removed the C: unstable formatting Formatting changed on the second pass label Apr 2, 2021
@ichard26
Copy link
Collaborator

ichard26 commented Apr 2, 2021

Just rechecked, Black on master for these examples are no longer unstable, but the formatting is .. questionable. I'll leave this open for now.

(I'm really just removing the "unstable formatting" label because I'm doing some analysis of the instability issues we've got)

@ichard26
Copy link
Collaborator

Actually, I created an issue (GH-2113) about explicitly improving the style for this case so I'm going to close this as it's still half-way about instability.

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants