Skip to content

Commit 2b79ae6

Browse files
authored
Compare to enums with is in hot paths (#700)
1 parent 639099f commit 2b79ae6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bellows/ash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def close(self):
396396

397397
def _reject_frame(self) -> None:
398398
"""Send NAK and enter reject condition if not already rejected."""
399-
if self._ncp_state == NcpState.CONNECTED and not self._in_reject_condition:
399+
if self._ncp_state is NcpState.CONNECTED and not self._in_reject_condition:
400400
_LOGGER.debug("Entering reject condition, sending NAK")
401401
with contextlib.suppress(NcpFailure):
402402
self._write_frame(NakFrame(res=0, ncp_ready=0, ack_num=self._rx_seq))
@@ -653,7 +653,7 @@ async def _send_data_frame(self, frame: AshFrame) -> None:
653653

654654
try:
655655
for attempt in range(ACK_TIMEOUTS):
656-
if self._ncp_state == NcpState.FAILED:
656+
if self._ncp_state is NcpState.FAILED:
657657
_LOGGER.debug(
658658
"NCP is in a failed state, not sending: %r", frame
659659
)

0 commit comments

Comments
 (0)