From 13ee18261ae96257c3eef0a8317a1c45622e4367 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Mon, 23 Nov 2015 16:03:03 -0800 Subject: Use value equality for status codes --- src/python/grpcio/grpc/_links/invocation.py | 10 +++++----- src/python/grpcio/grpc/_links/service.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/python/grpcio') diff --git a/src/python/grpcio/grpc/_links/invocation.py b/src/python/grpcio/grpc/_links/invocation.py index 67ef86a176..23ce12a787 100644 --- a/src/python/grpcio/grpc/_links/invocation.py +++ b/src/python/grpcio/grpc/_links/invocation.py @@ -182,15 +182,15 @@ class _Kernel(object): def _on_finish_event(self, operation_id, event, rpc_state): _no_longer_due(_FINISH, rpc_state, operation_id, self._rpc_states) - if event.status.code is _intermediary_low.Code.OK: + if event.status.code == _intermediary_low.Code.OK: termination = links.Ticket.Termination.COMPLETION - elif event.status.code is _intermediary_low.Code.CANCELLED: + elif event.status.code == _intermediary_low.Code.CANCELLED: termination = links.Ticket.Termination.CANCELLATION - elif event.status.code is _intermediary_low.Code.DEADLINE_EXCEEDED: + elif event.status.code == _intermediary_low.Code.DEADLINE_EXCEEDED: termination = links.Ticket.Termination.EXPIRATION - elif event.status.code is _intermediary_low.Code.UNIMPLEMENTED: + elif event.status.code == _intermediary_low.Code.UNIMPLEMENTED: termination = links.Ticket.Termination.REMOTE_FAILURE - elif event.status.code is _intermediary_low.Code.UNKNOWN: + elif event.status.code == _intermediary_low.Code.UNKNOWN: termination = links.Ticket.Termination.LOCAL_FAILURE else: termination = links.Ticket.Termination.TRANSMISSION_FAILURE diff --git a/src/python/grpcio/grpc/_links/service.py b/src/python/grpcio/grpc/_links/service.py index f56df84007..01edee6896 100644 --- a/src/python/grpcio/grpc/_links/service.py +++ b/src/python/grpcio/grpc/_links/service.py @@ -254,12 +254,12 @@ class _Kernel(object): rpc_state = self._rpc_states[call] _no_longer_due(_FINISH, rpc_state, call, self._rpc_states) code = event.status.code - if code is _intermediary_low.Code.OK: + if code == _intermediary_low.Code.OK: return - if code is _intermediary_low.Code.CANCELLED: + if code == _intermediary_low.Code.CANCELLED: termination = links.Ticket.Termination.CANCELLATION - elif code is _intermediary_low.Code.DEADLINE_EXCEEDED: + elif code == _intermediary_low.Code.DEADLINE_EXCEEDED: termination = links.Ticket.Termination.EXPIRATION else: termination = links.Ticket.Termination.TRANSMISSION_FAILURE -- cgit v1.2.3