Skip to content

fix(retries): Return a str from RetryException.__str__ - #127788

Draft
joshuarli wants to merge 1 commit into
masterfrom
fix/retry-exception-str
Draft

joshuarli wants to merge 1 commit into
masterfrom
fix/retry-exception-str

Conversation

@joshuarli

Copy link
Copy Markdown
Member

RetryException.__str__ returned force_bytes(self.message, errors="replace"), so str(exception) raised TypeError: __str__ returned non-string (type bytes). Anything that formats the exception, such as a logging call with %s, hit that error instead of printing the retry message. It now returns force_str(...), and a bytes message is still decoded with replacement.

TimedRetryPolicy is the only raiser in this repo and its message is already a str, so the visible change is that formatting the exception works.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 16, 2026
RetryException.__str__ returned force_bytes(...), so str(exception) raised TypeError: __str__ returned non-string (type bytes). Anything that formats the exception, such as a logging call with %s, failed instead of showing the retry message. Return force_str(...) so the message is rendered as text, with undecodable bytes replaced as before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub Team: python-typing Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant