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

INTERNAL ERROR: Black produced different code on the second pass of the formatter. #2075

Closed
zuckerruebe opened this issue Mar 29, 2021 · 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

@zuckerruebe
Copy link

zuckerruebe commented Mar 29, 2021

Describe the bug

INTERNAL ERROR: Black produced different code on the second pass of the formatter.

To Reproduce

  1. Take this file.
  2. Run Black on it with no arguments
  3. See error

Expected behavior

The file should be reformatted without an error.

Environment (please complete the following information):

  • Version: 20.8b1
  • OS and Python version: Windows 10/Python 3.9.0

Does this bug also happen on master?

Yes

Additional context

Created diff: blk_w6sikjrv.log

@zuckerruebe zuckerruebe added the T: bug Something isn't working label Mar 29, 2021
@martyzz1
Copy link

martyzz1 commented Apr 1, 2021

Just had one of these occur

circleci@fae532c171e7:~$ cat /tmp/blk_vwo8a_5x.log

Mode(target_versions={<TargetVersion.PY38: 8>}, line_length=119, string_normalization=True, experimental_string_processing=False, is_pyi=False)
--- source
+++ first pass
@@ -1805,12 +1805,14 @@
 
     def is_exempt_for_subscription(self, tx: Transaction) -> bool:
         return tx.is_direct_debit and tx.is_subscription and tx.merchant is not None and tx.merchant.is_coconut
 
     def is_transaction_counted_for_limit(self, tx: Transaction) -> bool:
-        return tx.status not in [Transaction.STATUS_FAILED, Transaction.STATUS_ERROR] \
-               and not self.is_exempt_for_subscription(tx)
+        return tx.status not in [
+            Transaction.STATUS_FAILED,
+            Transaction.STATUS_ERROR,
+        ] and not self.is_exempt_for_subscription(tx)
 
     def update_subscription_counters(self, tx: Transaction):
 
         """
         Increment transaction counters on the subscription.
--- first pass
+++ second pass
@@ -1805,14 +1805,18 @@
 
     def is_exempt_for_subscription(self, tx: Transaction) -> bool:
         return tx.is_direct_debit and tx.is_subscription and tx.merchant is not None and tx.merchant.is_coconut
 
     def is_transaction_counted_for_limit(self, tx: Transaction) -> bool:
-        return tx.status not in [
-            Transaction.STATUS_FAILED,
-            Transaction.STATUS_ERROR,
-        ] and not self.is_exempt_for_subscription(tx)
+        return (
+            tx.status
+            not in [
+                Transaction.STATUS_FAILED,
+                Transaction.STATUS_ERROR,
+            ]
+            and not self.is_exempt_for_subscription(tx)
+        )
 
     def update_subscription_counters(self, tx: Transaction):
 
         """
         Increment transaction counters on the subscription.

installed using pre-commit

repo: https://github.com/psf/black
    rev: 20.8b1
    hooks:
      - id: black
        language_version: python3  # Should be a command that runs python3.6+
        args: [-t, py38, -l, "119"]

@ichard26 ichard26 added the C: unstable formatting Formatting changed on the second pass label Apr 4, 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!

@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Apr 25, 2021
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