Black: Black produced different code on the second pass of the formatter: Explicit line join in the first line

Created on 9 Jul 2019  路  2Comments  路  Source: psf/black

Operating system: macOS Mojave 10.14.5 (18F132)
Python version: Python 3.7.3
Black version: 19.3b0 (f3bb22a828)
Does also happen on master: yes

Minified reproducer:

\


pass

Black diff:

--- source
+++ first pass
@@ -1,5 +1,3 @@
-\
-

 pass

--- first pass
+++ second pass
@@ -1,3 +1,2 @@
-
 pass

Looks like some kind of boundary condition in EmptyLineTracker?

bug unstable formatting

All 2 comments

I have a proposed fix for this in #948 - open to review (cc: @zsol).

So, Python 3.9 actually considers the reproducer here to be invalid syntax, and that has broken the Black tests on Python 3.9. See https://github.com/psf/black/issues/1441#issuecomment-637733971 .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

layoaster picture layoaster  路  3Comments

madig picture madig  路  3Comments

dimaqq picture dimaqq  路  3Comments

kissgyorgy picture kissgyorgy  路  3Comments

testvinder picture testvinder  路  3Comments