Skip to content

INTERNAL ERROR on 26.5.0 #5138

Closed
Closed

Description

@AlexeyDmitriev

Describe the bug

Fails with INTERNAL ERROR on small file

To Reproduce
Contents of repro.py:

a = 1  # type: ignore
b = 1  # fmt: skip

Reproduce:

    $ black --check repro.py
    error: cannot format repro.py: INTERNAL ERROR: Black 26.5.0 on Python
    (CPython) 3.12.11 produced code that is not equivalent to the source.
    Please report a bug on https://github.com/psf/black/issues.  This diff
    might be helpful: /tmp/blk_XXXX.log

The diff is

--- src
+++ dst
@@ -37,8 +37,6 @@
             value=
             1,  # int
         )  # /Constant
     )  # /Assign
     type_ignores=
-    TypeIgnore(
-    )  # /TypeIgnore
 )  # /Module
\ No newline at end of file

Expected behavior

successful formatting

Environment

➜  ✗ black --version                                
black, 26.5.0 (compiled: yes)
Python (CPython) 3.12.11

Ubuntu 20.04

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions