Repository navigation
Fix Python 3.16 retry compatibility with python-backoff - #1205
Open
BookCatKid wants to merge 2 commits into
Open
BookCatKid wants to merge 2 commits into
BookCatKid wants to merge 2 commits into
Conversation
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.
Describe what the PR does:
Prevent Python 3.16 retry failures by replacing the original
backoffdependency (which calls the removedasyncio.iscoroutinefunction()API) with the maintainedpython-backoff>=2.3.1fork.The dependency swap alone is not safe for SimpliSafe: on
python-backoff2.4.0, nine existing tests fail because the retry callbacks callsys.exc_info()after the fork has exited the exception handler. The fork supplies the caught exception in the callbackdetails["exception"]; use that documented callback detail in both_async_handle_on_backoffand_handle_on_giveupinstead. This preserves the 401 token-refresh behavior, the give-up exception chaining, and compatibility with both 2.3.1 and 2.4.0. Existing API method interfaces stay the same.The Poetry lockfile was regenerated using Poetry 2.4.1, matching its existing generator; it only changes the affected dependency entries.
Testing:
backoff2.2.1: 94 tests passed.python-backoff2.4.0 before callback fix: 9 tests failed, demonstrating the issue.python-backoff3.1.0: 95 tests passed on Python 3.14.poetry check --lock, Black formatting check for the new test, andgit diff --checkpassed._refresh_token_callbackswas not modified.No real SimpliSafe cloud credentials or equipment were needed for these mocked tests.
Does this fix a specific issue?
No existing upstream issue identified; fixes the Python 3.16 incompatibility reported by Home Assistant Hassfest.
Checklist:
README.mdwith any new documentation. (Not applicable: internal compatibility change only; no documented API change.)