Closed
Description
Version: 4.3.4
Description
The is_connected
property of the Connection
class in redis.asyncio.connection.py
returns either None
, a StreamReader
or a StreamWriter
rather than a boolean value as would be expected.
While this will work for all cases where the "truthiness" is checked directly, it could cause weird issues in other cases.
Such as logging the connection state, for example:
# Prints: "Connection connected: <StreamWriter transport=<_ProactorSocketTransport fd=484 read=<_OverlappedFuture pending overlapped=<pending, 0x1666c1aa940> cb=[_ProactorReadPipeTransport._loop_reading()]>> reader=<StreamReader transport=<_ProactorSocketTransport fd=484 read=<_OverlappedFuture pending overlapped=<pending, 0x1666c1aa940> cb=[_ProactorReadPipeTransport._loop_reading()]>>>>"
print(f'Connection connected: {connection.is_connected}')
Metadata
Metadata
Assignees
Labels
No labels