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

On Master: INTERNAL ERROR: Black produced different code on the second pass of the formatter. #1969

Closed
tommyjcarpenter opened this issue Feb 5, 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

@tommyjcarpenter
Copy link

tommyjcarpenter commented Feb 5, 2021

Describe the bug A clear and concise description of what the bug is.

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

To Reproduce Steps to reproduce the behavior:

  1. Take this file
from f.index import I
import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar


class Foo(I):
    def __init__(self, id, sec="TY"):
        super().__init__(id)
        self.sec = sec
        if self.sec == "TY":
            self.rebalance_dates = (pd.date_range(start="2001-02-01",
                                       end="2019-09-30",
                                       freq=pd.offsets.CustomBusinessMonthEnd(n=3,
                                                                              calendar=USFederalHolidayCalendar()))
                               - pd.offsets.CustomBusinessDay(2, calendar=USFederalHolidayCalendar()))
  1. Run Black on it with these arguments: line-length=120 IE black --line-length 120 fut_black.py
  2. See error
error: cannot format fut_black.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.

Expected behavior A clear and concise description of what you expected to happen.

it works and does not fail

Environment (please complete the following information):

  • Version: [e.g. master] black, version 20.8b1
  • OS and Python version: [e.g. Linux/Python 3.7.4rc1] Mac big sur, Python 3.9.1

Does this bug also happen on master? To answer this, you have two options:

YES: https://black.now.sh/?version=master&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4AL8AVBdAD2IimZxl1N_WlkPinBFn-cYonV7eCOMygG8rVB4VnmDCouqoBdRV1UuH1GlOkKjrnnM_UPrsADWpdtkn6p7zhnptKkCDeEshX4CR4UYfK04Rt8A40Jd2ZVPmE0pX0tQ4Ihpay5BWB9wVKae4wFyynWuAq3OTiCVooq5xu_OiW1uvoVwkjk31OcLYnxcricdzytnv3PquX4rOFP9WBcz0N8DhrtoC8pMOK-Y0bz_FArDXxKdCj9W_rW72NgZuo4shR3WsfdLqetgpEpfuRTxrAKnlTRQCMU6s5lN8LrS8HSMQyRfWxXCcRLvEE9Q-JqPCPMntqnAgZ7FsYEnrpdESJx_fdDlVYuNylMnhRhWgvOpHuqmAJon-FiAF2yZRcWqQ6eDX8kDVTI0rB3zQjpZZMzCZU1Cpk4J5WFQFh7mFJsNdt2j-lw5Yc2hsUSXGaldAAA5KQgB1ExVXwAB7AL9BQAA1VDUqrHEZ_sCAAAAAARZWg==

  1. Use the online formatter at https://black.now.sh/?version=master, which will use the
    latest master branch.

If you dump this file into that online editor, it will complain

@tommyjcarpenter tommyjcarpenter added the T: bug Something isn't working label Feb 5, 2021
@tommyjcarpenter tommyjcarpenter changed the title INTERNAL ERROR: Black produced different code on the second pass of the formatter. Please report a bug on On Master: INTERNAL ERROR: Black produced different code on the second pass of the formatter. Feb 5, 2021
@ichard26 ichard26 added the C: unstable formatting Formatting changed on the second pass label Feb 5, 2021
@mvolfik
Copy link

mvolfik commented Feb 22, 2021

Likely a duplicate of #1629 , as this file works after applying #1958

@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