Skip to content

Regression in 3.12.5 causing non-deterministic failures in Black #123821

Closed
@hauntsaninja

Description

@hauntsaninja

Bug report

Bug description:

#122063 causes Black to fail non-deterministically.

To reproduce:

printf 'import argparse
import string


S1 = f"{argparse.OPTIONAL[:9]=}"
S2 = (string.ascii_uppercase + string.ascii_lowercase)
' > test.py

python3.12 -m pip install --no-cache-dir --upgrade black --target tmpenv
for i in $(seq 1 10); do PYTHONPATH=tmpenv ./python.exe -m black --check --diff test.py; done

You now non-deterministically get:

error: cannot format test.py: INTERNAL ERROR: Black 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: /var/folders/0y/.../T/....log

Note I think you need a non-debug build and probably a Mac

cc @pablogsal

CPython versions tested on:

3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions