fix: avoid instantiating a connection on repr_ by robertosantamaria-scopely · Pull Request #3653 · redis/redis-py (original) (raw)

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

[ Show hidden characters]({{ revealButtonHref }})

@robertosantamaria-scopely

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.

@robertosantamaria-scopely

@petyaslavova

petyaslavova

@robertosantamaria-scopely

@petyaslavova

@petyaslavova

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:

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

ManelCoutinhoSensei pushed a commit to ManelCoutinhoSensei/redis-py that referenced this pull request

Jun 30, 2025


Co-authored-by: petyaslavova petya.slavova@redis.com

ManelCoutinhoSensei pushed a commit to ManelCoutinhoSensei/redis-py that referenced this pull request

Jul 1, 2025


Co-authored-by: petyaslavova petya.slavova@redis.com

petyaslavova added a commit that referenced this pull request

Jul 25, 2025

@robertosantamaria-scopely @petyaslavova


Co-authored-by: petyaslavova petya.slavova@redis.com

Labels