From 3e3bbdff917e5c56f6c29bc35c8eb989192325e7 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 28 Sep 2017 22:36:31 +0000 Subject: [PATCH 1/3] Raise exception instances rather than classes --- src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index d860173b5d4..782a684d255 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -454,7 +454,7 @@ cdef class _MetadataIterator: self.i = self.i + 1 return result else: - raise StopIteration + raise StopIteration() # TODO(https://github.com/grpc/grpc/issues/7950): Eliminate this; just use an @@ -518,7 +518,7 @@ cdef class MetadataArray: def __getitem__(self, size_t i): if i >= self.c_metadata_array.count: - raise IndexError + raise IndexError() key = _slice_bytes(self.c_metadata_array.metadata[i].key) value = _slice_bytes(self.c_metadata_array.metadata[i].value) return Metadatum(key=key, value=value) @@ -720,7 +720,7 @@ cdef class _OperationsIterator: self.i = self.i + 1 return result else: - raise StopIteration + raise StopIteration() cdef class Operations: From 4ceb743c82606381a8c734e7d33481b400aea68c Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 28 Sep 2017 22:37:38 +0000 Subject: [PATCH 2/3] Drop unused staticmethods --- src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index 782a684d255..4f87261e173 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -171,14 +171,6 @@ cdef class Timespec: gpr_convert_clock_type(self.c_time, GPR_CLOCK_REALTIME)) return real_time.seconds + real_time.nanoseconds / 1e9 - @staticmethod - def infinite_future(): - return Timespec(float("+inf")) - - @staticmethod - def infinite_past(): - return Timespec(float("-inf")) - def __richcmp__(Timespec self not None, Timespec other not None, int op): cdef gpr_timespec self_c_time = self.c_time cdef gpr_timespec other_c_time = other.c_time From 3efe754799ac46f7be6502ba3e20a39743d9fb0d Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 28 Sep 2017 22:38:06 +0000 Subject: [PATCH 3/3] "resopnse" typo correction --- .../grpcio_tests/tests/unit/_metadata_code_details_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py b/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py index 9f72b1fcb58..6faab94be64 100644 --- a/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py +++ b/src/python/grpcio_tests/tests/unit/_metadata_code_details_test.py @@ -29,7 +29,7 @@ _SERIALIZED_RESPONSE = b'\x49\x50\x51' _REQUEST_SERIALIZER = lambda unused_request: _SERIALIZED_REQUEST _REQUEST_DESERIALIZER = lambda unused_serialized_request: object() _RESPONSE_SERIALIZER = lambda unused_response: _SERIALIZED_RESPONSE -_RESPONSE_DESERIALIZER = lambda unused_serialized_resopnse: object() +_RESPONSE_DESERIALIZER = lambda unused_serialized_response: object() _SERVICE = 'test.TestService' _UNARY_UNARY = 'UnaryUnary'