From c666aa6151dc033dc7dcb3be5552d01a6145fa67 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Thu, 2 Aug 2018 02:30:08 -0700 Subject: [PATCH] Add low-level Cython debug/expansion hooks --- .../grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi | 16 ++++++++++++++++ .../grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi | 17 +++++++++++++++++ .../grpcio/grpc/_cython/_cygrpc/call.pyx.pxi | 2 ++ .../grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 2 +- src/python/grpcio/grpc/_cython/cygrpc.pxd | 1 + src/python/grpcio/grpc/_cython/cygrpc.pyx | 1 + 6 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi new file mode 100644 index 00000000000..e8f597459d9 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pxd.pxi @@ -0,0 +1,16 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef object _custom_op_on_c_call(grpc_call *call) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi new file mode 100644 index 00000000000..008c62ff2c4 --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/_hooks.pyx.pxi @@ -0,0 +1,17 @@ +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +cdef object _custom_op_on_c_call(grpc_call *call): + return None diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index 2e02111ddd9..a6aae935c51 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -94,3 +94,5 @@ cdef class Call: def is_valid(self): return self.c_call != NULL + def _custom_op_on_c_call(self): + return _custom_op_on_c_call(self.c_call) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 8c37a3cf852..893df8eac67 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -300,7 +300,7 @@ cdef class SegregatedCall: def next_event(self): def on_success(tag): _process_segregated_call_tag( - self._channel_state, self._call_state, self._c_completion_queue, tag) + self._channel_state, self._call_state, self._c_completion_queue, tag) return _next_call_event( self._channel_state, self._c_completion_queue, on_success) diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pxd b/src/python/grpcio/grpc/_cython/cygrpc.pxd index e33c01c28f5..0cc26bc0d05 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pxd +++ b/src/python/grpcio/grpc/_cython/cygrpc.pxd @@ -28,5 +28,6 @@ include "_cygrpc/security.pxd.pxi" include "_cygrpc/server.pxd.pxi" include "_cygrpc/tag.pxd.pxi" include "_cygrpc/time.pxd.pxi" +include "_cygrpc/_hooks.pxd.pxi" include "_cygrpc/grpc_gevent.pxd.pxi" diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index fb16fb16bfb..3cac406687c 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -35,6 +35,7 @@ include "_cygrpc/security.pyx.pxi" include "_cygrpc/server.pyx.pxi" include "_cygrpc/tag.pyx.pxi" include "_cygrpc/time.pyx.pxi" +include "_cygrpc/_hooks.pyx.pxi" include "_cygrpc/grpc_gevent.pyx.pxi"