diff options
author | Masood Malekghassemi <soltanmm@users.noreply.github.com> | 2015-11-23 16:03:03 -0800 |
---|---|---|
committer | Masood Malekghassemi <soltanmm@users.noreply.github.com> | 2015-12-07 17:10:55 -0800 |
commit | 13ee18261ae96257c3eef0a8317a1c45622e4367 (patch) | |
tree | 74b5ef7819c82e5adbc474b31880fed8c8b61c7d /src/python/grpcio | |
parent | 7a6b0a4293fe39445aeb85b091fec07f9e9f5f0a (diff) |
Use value equality for status codes
Diffstat (limited to 'src/python/grpcio')
-rw-r--r-- | src/python/grpcio/grpc/_links/invocation.py | 10 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_links/service.py | 6 |
2 files changed, 8 insertions, 8 deletions
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 |