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 with long conditional expression #1804

Closed
wyattanderson opened this issue Nov 3, 2020 · 2 comments
Closed

Unstable formatting with long conditional expression #1804

wyattanderson opened this issue Nov 3, 2020 · 2 comments
Labels
C: unstable formatting Formatting changed on the second pass R: duplicate This issue or pull request already exists T: bug Something isn't working

Comments

@wyattanderson
Copy link

To Reproduce

Run Black on this code:

if shopify_order_action in [SHOPIFY_HEADER_ORDER_FULFILLED, SHOPIFY_HEADER_ORDER_PARTIALLY_FULFILLED] and (not fulfillments or len(fulfillments) == 0):
    pass

The code itself isn't fantastic, for sure, but it still breaks Black, and that ain't great.

Reformatting fails with error: cannot format testcase.py: INTERNAL ERROR: Black produced different code on the second pass of the formatter..

Environment (please complete the following information):

  • Version: latest release on PyPI and on master
  • OS and Python version: Mac OS X, Python 3.8.5

Does this bug also happen on master?

Yes, running this on black.now.sh also fails.

@wyattanderson wyattanderson added the T: bug Something isn't working label Nov 3, 2020
@mik-laj
Copy link

mik-laj commented Nov 4, 2020

I have more examples.
apache/airflow#12091

@ichard26 ichard26 added the C: unstable formatting Formatting changed on the second pass label Nov 4, 2020
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Apr 25, 2021
@ichard26
Copy link
Collaborator

Hello!

All reproduction cases in this issue format without error on master. The fixing commit was 8672af3 from PR GH-2126. I'll be marking this issue as a duplicate of GH-1629 since that's what GH-2126 aimed to fix and it's highly likely this issue falls under GH-1629.

Since we use the issue tracker as a reflection of what's on master, I'll be closing this issue. If you have any issues, especially with the new (but stable) output, please open a new issue. Oh and the fix should be available in a published release soon, see GH-2125 for more info.

Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: unstable formatting Formatting changed on the second pass R: duplicate This issue or pull request already exists T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants