Fix str / repr for StripeObjects with decimals & add support for plain dicts#1780
Merged
xavdid-stripe merged 4 commits intomasterfrom Mar 31, 2026
Merged
Fix str / repr for StripeObjects with decimals & add support for plain dicts#1780xavdid-stripe merged 4 commits intomasterfrom
str / repr for StripeObjects with decimals & add support for plain dicts#1780xavdid-stripe merged 4 commits intomasterfrom
Conversation
str / repr) for objects with decimals
str / repr) for objects with decimalsstr / repr) for objects with decimals & add support for plain dicts
xavdid-stripe
commented
Mar 31, 2026
jar-stripe
reviewed
Mar 31, 2026
str / repr) for objects with decimals & add support for plain dictsstr / repr for StripeObjects with decimals & add support for plain dicts
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.
Why?
We added support for native decimal types in #1769 but our code for stringifying objects for printing didn't account for it. (API requests handled it as expected). To fix, we cenralized our serialization logic so that both paths (which both end up sending things to JSON) use the same logic.
While I was in there, the user requested being able to get a JSON-dumpable
dictthat isn't yet a string. Since we have all the code to do that already, I added an arg to support it.What?
to_dictfor_jsonkwarg toto_dict()See Also
#1779