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

Black produced different code on the second pass of the formatter #2008

Closed
cjfuller opened this issue Feb 26, 2021 · 2 comments
Closed

Black produced different code on the second pass of the formatter #2008

cjfuller opened this issue Feb 26, 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

@cjfuller
Copy link

Describe the bug

While running black, I get the error message INTERNAL ERROR: Black produced different code on the second pass of the formatter. Please report a bug on https://github.com/psf/black/issues.

To Reproduce

  1. Start with https://github.com/cjfuller/M33-Fio/blob/9ac4a36ebc1433294d3e28b5dfbc8be89036c2bb/octoprint_m33fio/__init__.py
  2. run black octoprint_m33fio/__init__.py (from a checkout of the root of that repository)
  3. get the above error message, with a diff linked. Gist for the diff it outputs (it's a ~31k line diff unfortunately, so I didn't inline it).

Expected behavior

I expected it to format the file without error.

Environment (please complete the following information):

  • Version: 20.8b1
  • OS and Python version: MacOS 11.2, Cpython 3.8.2

Does this bug also happen on master?
yes (via local clone / installation)

Additional context

Apologies for the report that is so far from a minimal repro; I'm attempting to resurrect someone else's abandoned and unusually formatted project, so there's a ton of code that needs formatting. I figured I'd report it anyway, since it said to do so, but if this isn't useful, please just ignore. The "run twice with --fast" trick fixes it so this is easy to work around.

@cjfuller cjfuller added the T: bug Something isn't working label Feb 26, 2021
@jeffrey-cochran
Copy link

I just experienced the same bug.

@ichard26 ichard26 added the C: unstable formatting Formatting changed on the second pass label Feb 26, 2021
@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