Repository navigation
Fix missing f-string prefix in two DataError messages - #1373
Merged
dvarrazzo merged 1 commit intoJul 18, 2026
Merged
Conversation
Two error messages were built from plain string literals containing
{...} placeholders but missing the f prefix, so the literal placeholder
text was shown to the user instead of the offending value:
- types/datetime.py: "timestamp too small (before year 1): {s!r}"
- types/json.py: "unknown jsonb binary format: {data[0]}"
The sibling branches next to the datetime message are already f-strings,
which is what makes the omission stand out. Add the missing prefix to
both so the value is interpolated.
Fixes psycopg#1372
Member
|
Merged, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two
DataErrormessages were built from plain string literals containing{...}placeholders but missing thefprefix, so the literal placeholder text was shown to the user instead of the offending value.psycopg/types/datetime.py—_get_timestamp_load_error():"timestamp too small (before year 1): {s!r}"psycopg/types/json.py—JsonbBinaryLoader.load():"unknown jsonb binary format: {data[0]}"The two sibling branches right next to the datetime message are already f-strings (
f"timestamp too large (after year 10K): {s!r}",f"can't parse timestamp {s!r}: ..."), which is what makes the omission stand out.Before
After
A repo-wide grep confirms these are the only two occurrences of the pattern; every other
{...}-in-a-plain-string case is an intentionalsql.SQL(...).format(...)template.Fixes #1372