Skip to content

Commit 3813507

Browse files
committed
pull the encoding attrs directly off a connection. fixes redis#455
1 parent f49debc commit 3813507

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

redis/client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,10 +1887,13 @@ def __init__(self, connection_pool, shard_hint=None,
18871887
self.connection = None
18881888
# we need to know the encoding options for this connection in order
18891889
# to lookup channel and pattern names for callback handlers.
1890-
connection_kwargs = self.connection_pool.connection_kwargs
1891-
self.encoding = connection_kwargs['encoding']
1892-
self.encoding_errors = connection_kwargs['encoding_errors']
1893-
self.decode_responses = connection_kwargs['decode_responses']
1890+
conn = connection_pool.get_connection('pubsub', shard_hint)
1891+
try:
1892+
self.encoding = conn.encoding
1893+
self.encoding_errors = conn.encoding_errors
1894+
self.decode_responses = conn.decode_responses
1895+
finally:
1896+
connection_pool.release(conn)
18941897
self.reset()
18951898

18961899
def __del__(self):

0 commit comments

Comments
 (0)