Public bug reported:
OS: Kubuntu 24.04.3.
Steps to reproduce.
1. Create ~/test.py with the following contents:
arr = ["a", "b", "c"]
print(f"{"".join(arr)}")
2. Run the script: `python3 ~/test.py`
3. Format the script: `black -l80 ~/test.py`
4. Run the script again: `python3 ~/test.py`
Expected result: Script output should be unchanged (it should output
"abc" both times).
Actual result: Script output is different after formatting with black;
the post-formatting script outputs "a b c" instead of "abc". Moreover,
the code is modified to the following (note the extra space inserted
into the f-string):
arr = ["a", "b", "c"]
print(f"{" ".join(arr)}")
ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: black 24.2.0-1ubuntu1
ProcVersionSignature: Ubuntu 6.11.0-26.26+kfocus2-kfocus 6.11.11
Uname: Linux 6.11.0-26-kfocus x86_64
ApportVersion: 2.28.1-0ubuntu3.8
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: KDE
Date: Wed Sep 17 20:27:07 2025
InstallationDate: Installed on 2025-02-08 (221 days ago)
InstallationMedia: Kubuntu 24.04.1 LTS "Noble Numbat" (20241219)
PackageArchitecture: all
SourcePackage: black
UpgradeStatus: No upgrade log present (probably fresh install)
** Affects: black (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug noble
** Bug watch added: github.com/psf/black/issues #4268
https://github.com/psf/black/issues/4268
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2125024
Title:
Corrupts f-strings by changing empty strings in evaluated blocks into
single-space strings
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/black/+bug/2125024/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs