mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2025-01-13 20:11:42 +01:00
Fix performance regression in debug logging from win32 protobuf crash workaround (#940)
This commit is contained in:
parent
059af0e000
commit
fce8922aa3
@ -12,6 +12,7 @@ cdef float KEEP_ALIVE_TIMEOUT_RATIO
|
||||
cdef object HANDSHAKE_TIMEOUT
|
||||
|
||||
cdef bint TYPE_CHECKING
|
||||
cdef bint _WIN32
|
||||
|
||||
cdef object WRITE_EXCEPTIONS
|
||||
|
||||
|
@ -101,6 +101,7 @@ TCP_CONNECT_TIMEOUT = 60.0
|
||||
|
||||
WRITE_EXCEPTIONS = (RuntimeError, ConnectionResetError, OSError)
|
||||
|
||||
_WIN32 = sys.platform == "win32"
|
||||
|
||||
_int = int
|
||||
_bytes = bytes
|
||||
@ -719,7 +720,7 @@ class APIConnection:
|
||||
# calling __str__ on the message may crash on
|
||||
# Windows systems due to a bug in the protobuf library
|
||||
# so we call MessageToDict instead
|
||||
MessageToDict(msg),
|
||||
MessageToDict(msg) if _WIN32 else msg,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -921,7 +922,7 @@ class APIConnection:
|
||||
# calling __str__ on the message may crash on
|
||||
# Windows systems due to a bug in the protobuf library
|
||||
# so we call MessageToDict instead
|
||||
MessageToDict(msg),
|
||||
MessageToDict(msg) if _WIN32 else msg,
|
||||
)
|
||||
|
||||
if self._pong_timer is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user