diff --git a/CHANGES.md b/CHANGES.md index 3a96029bf5c..22ddc423e55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,8 @@ - Add support for formatting Jupyter Notebook files (#2357) - Move from `appdirs` dependency to `platformdirs` (#2375) - Present a more user-friendly error if .gitignore is invalid (#2414) +- The failsafe for accidentally added backslashes in f-string expressions has been + hardened to handle more edge cases during quote normalization (#2437) ### Integrations diff --git a/src/black/strings.py b/src/black/strings.py index 80f588f5119..d7b6c240e80 100644 --- a/src/black/strings.py +++ b/src/black/strings.py @@ -190,9 +190,9 @@ def normalize_string_quotes(s: str) -> str: if "f" in prefix.casefold(): matches = re.findall( r""" - (?:[^{]|^)\{ # start of the string or a non-{ followed by a single { + (?:(?