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. with walrus #1721

Closed
KotlinIsland opened this issue Sep 23, 2020 · 3 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

@KotlinIsland
Copy link
Contributor

if it := 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff':
    print(it)
Mode(target_versions=set(), line_length=88, string_normalization=True, experimental_string_processing=False, is_pyi=False)
--- source
+++ first pass
@@ -1,2 +1,4 @@
-if it := 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff':
+if (
+    it := "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+):
     print(it)
--- first pass
+++ second pass
@@ -1,4 +1,4 @@
 if (
     it := "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
-):
+) :
     print(it)
@KotlinIsland KotlinIsland added the T: bug Something isn't working label Sep 23, 2020
@matthiask
Copy link

matthiask commented Nov 21, 2020

I encountered this as well:

Mode(target_versions=set(), line_length=88, string_normalization=True, experimental_string_processing=False, is_pyi=False)
--- source
+++ first pass
@@ -80,13 +80,15 @@
     )
 
 
 @student_required
 def buy(request):
-    if item := Item.objects.buyable_by(request.user).filter(
-        identifier=request.POST.get("identifier")
-    ).first():
+    if (
+        item := Item.objects.buyable_by(request.user)
+        .filter(identifier=request.POST.get("identifier"))
+        .first()
+    ):
         request.user.owned_items.add(item)
         request.user.equip_item(item)
         request.user.recalculate(save=True)
     return JsonResponse(
         {
--- first pass
+++ second pass
@@ -84,11 +84,11 @@
 def buy(request):
     if (
         item := Item.objects.buyable_by(request.user)
         .filter(identifier=request.POST.get("identifier"))
         .first()
-    ):
+    ) :
         request.user.owned_items.add(item)
         request.user.equip_item(item)
         request.user.recalculate(save=True)
     return JsonResponse(
         {

@ichard26 ichard26 added R: duplicate This issue or pull request already exists C: unstable formatting Formatting changed on the second pass labels Dec 29, 2020
@ichard26
Copy link
Collaborator

This was fixed in commit 1d2d726 from PR #1655: ''Fix incorrect space before colon in if/while stmts". This issue is technically a duplicate of #1194 but I'll leave this open until a release ships with the fix mentioned above.

@jku
Copy link

jku commented Apr 27, 2021

This can be closed now?

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

5 participants