-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: avoid instantiating a connection on _repr__ #3653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
petyaslavova
merged 5 commits into
redis:master
from
robertosantamaria-scopely:fix-pool-repr
May 29, 2025
Merged
fix: avoid instantiating a connection on _repr__ #3653
petyaslavova
merged 5 commits into
redis:master
from
robertosantamaria-scopely:fix-pool-repr
May 29, 2025
+18
−12
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refines the connection pool’s string representation by avoiding the instantiation of a connection within repr methods. Key changes include:
- Updating repr in both synchronous and asynchronous connection implementations to prevent side effects.
- Adjusting tests to match the updated repr output format.
- Modifying URL-based connection tests to include an explicit database parameter.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/test_connection_pool.py | Updated expected repr strings for ConnectionPool in TCP and Unix socket scenarios. |
tests/test_asyncio/test_connection_pool.py | Similar repr string updates for the async ConnectionPool tests. |
redis/connection.py | Revised repr to assemble connection kwargs without instantiating a new connection. |
redis/asyncio/connection.py | Similar updates to repr for the async connection implementation. |
vladvildanov
approved these changes
May 29, 2025
ManelCoutinhoSensei
pushed a commit
to ManelCoutinhoSensei/redis-py
that referenced
this pull request
Jun 30, 2025
* fix: avoid instantiating a connection on _repr__ * include full kwargs * Adding repr fix in async connection pool. Fix failing tests. --------- Co-authored-by: petyaslavova <[email protected]>
ManelCoutinhoSensei
pushed a commit
to ManelCoutinhoSensei/redis-py
that referenced
this pull request
Jul 1, 2025
* fix: avoid instantiating a connection on _repr__ * include full kwargs * Adding repr fix in async connection pool. Fix failing tests. --------- Co-authored-by: petyaslavova <[email protected]>
petyaslavova
added a commit
that referenced
this pull request
Jul 25, 2025
* fix: avoid instantiating a connection on _repr__ * include full kwargs * Adding repr fix in async connection pool. Fix failing tests. --------- Co-authored-by: petyaslavova <[email protected]>
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.
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
Changing the
__repr__
methods in connection pool classes to avoid instantiating a connection object just to have its string representation.