aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2018-06-06 21:57:39 +0000
committerGravatar Nathaniel Manista <nathaniel@google.com>2018-06-06 21:57:39 +0000
commit9c86b20bacbb92ed9b8b43b56b2e2fdefcecedae (patch)
tree302f8a03f0bc7bc4d44da461a0b7a8e2538f0d21
parentca7ba4d0ac3ab452c5db60befc8be37fd6e2339b (diff)
Retain references to channel arguments
This works around issue 15662 which is not as easy to implement as I would prefer it to be.
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi2
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi3
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi2
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi1
4 files changed, 8 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi
index 65de30884c..aecd3d7b11 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi
@@ -15,10 +15,12 @@
cimport cpython
+# TODO(https://github.com/grpc/grpc/issues/15662): Reform this.
cdef void* _copy_pointer(void* pointer):
return pointer
+# TODO(https://github.com/grpc/grpc/issues/15662): Reform this.
cdef void _destroy_pointer(void* pointer):
pass
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
index eefc685c0b..f067d76fab 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi
@@ -69,3 +69,6 @@ cdef class Channel:
cdef grpc_arg_pointer_vtable _vtable
cdef _ChannelState _state
+
+ # TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this.
+ cdef tuple _arguments
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
index 72e74e84ae..8c37a3cf85 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi
@@ -390,6 +390,7 @@ cdef class Channel:
def __cinit__(
self, bytes target, object arguments,
ChannelCredentials channel_credentials):
+ arguments = () if arguments is None else tuple(arguments)
grpc_init()
self._state = _ChannelState()
self._vtable.copy = &_copy_pointer
@@ -410,6 +411,7 @@ cdef class Channel:
grpc_completion_queue_create_for_next(NULL))
self._state.c_connectivity_completion_queue = (
grpc_completion_queue_create_for_next(NULL))
+ self._arguments = arguments
def target(self):
cdef char *c_target
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
index 4588db30d3..52cfccb677 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi
@@ -23,6 +23,7 @@ cdef class Server:
cdef bint is_shutdown # notification of complete shutdown received
# used at dealloc when user forgets to shutdown
cdef CompletionQueue backup_shutdown_queue
+ # TODO(https://github.com/grpc/grpc/issues/15662): Elide this.
cdef list references
cdef list registered_completion_queues