GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Backslash in f-string format specifier gets escape · Issue #105194 · python/cpython Closed Labels type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBetween Python 3.12 alpha 7 and beta 1 the behaviour of format specifiers containing a backslash (e.g. Previously, the The following script demonstrates this: # issue.py class F: def __format__(self, format_spec): print("spec:", repr(format_spec)) return format_spec.join(["a", "b", "c"]) print("out: ", repr((f"{F():\n}"))) print("out: ", repr((f"{F():\u2603}"))) print("out: ", repr((format(F(), "\n")))) print("out: ", repr((format(F(), "\u2603")))) $ python3.11 issue.py spec: '\n' out: 'a\nb\nc' spec: '☃' out: 'a☃b☃c' spec: '\n' out: 'a\nb\nc' spec: '☃' out: 'a☃b☃c' $ python3.12 issue.py spec: '\\n' out: 'a\\nb\\nc' spec: '\\u2603' out: 'a\\u2603b\\u2603c' spec: '\n' out: 'a\nb\nc' spec: '☃' out: 'a☃b☃c' In both cases the I suspect this is related to the PEP 701 changes to f-strings, but I couldn't find anything in the discussion of that PEP to suggest this was a deliberate change. Your environment
Linked PRsActivity
MetadataMetadataAssigneesLabelstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |