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 split string + % formatting #1595

Closed
JelleZijlstra opened this issue Aug 13, 2020 · 2 comments · Fixed by #1680
Closed

Unstable formatting on split string + % formatting #1595

JelleZijlstra opened this issue Aug 13, 2020 · 2 comments · Fixed by #1680
Labels
C: unstable formatting Formatting changed on the second pass T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

This is on master.

$ cat kill_senior_procs.py 
if __name__ == "__main__":
    for i in range(4, 8):
        cmd = (
            r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk '{print $2}'); do kill $pid; done"
            % (i)
        )
$ black kill_senior_procs.py 
error: cannot format kill_senior_procs.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: /var/folders/wx/zkst6jdx1zg_s32d23gz4_0r0000gn/T/blk_bgpw4vyu.log
Oh no! 💥 💔 💥
1 file failed to reformat.
$ cat /var/folders/wx/zkst6jdx1zg_s32d23gz4_0r0000gn/T/blk_bgpw4vyu.log
--- source
+++ first pass
@@ -1,6 +1,7 @@
 if __name__ == "__main__":
     for i in range(4, 8):
         cmd = (
-            r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk '{print $2}'); do kill $pid; done"
+            r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk"
+            r" '{print $2}'); do kill $pid; done"
             % (i)
         )
--- first pass
+++ second pass
@@ -1,7 +1,6 @@
 if __name__ == "__main__":
     for i in range(4, 8):
         cmd = (
             r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk"
-            r" '{print $2}'); do kill $pid; done"
-            % (i)
+            r" '{print $2}'); do kill $pid; done" % (i)
         )
@JelleZijlstra JelleZijlstra added T: bug Something isn't working C: unstable formatting Formatting changed on the second pass labels Aug 13, 2020
@hugovk
Copy link
Contributor

hugovk commented Aug 13, 2020

And a fourth git bisect pointing to 544ea9c from "Improve String Handling" (#1132).

@hugovk
Copy link
Contributor

hugovk commented Aug 21, 2020

Also now good on master

$ black --check kill_senior_procs.py
All done! ✨ 🍰 ✨
1 file would be left unchanged.

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 T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants