diff options
author | Nathaniel Manista <nathaniel@google.com> | 2018-01-22 00:47:41 +0000 |
---|---|---|
committer | Nathaniel Manista <nathaniel@google.com> | 2018-01-26 07:09:28 +0000 |
commit | c73758acb02d5c21f77e5144976fd5603c24f72e (patch) | |
tree | 1dbf6a4e110aa501c287e23ea6ccd6159d4aef3d /src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | |
parent | 31ddbff8cfed36d77ad34ec892af812dff614ce6 (diff) |
Elide cygrpc.ChannelArg and cygrpc.ChannelArgs
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi')
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index efe5f2e0db..a3966497bc 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -17,26 +17,25 @@ cimport cpython cdef class Channel: - def __cinit__(self, bytes target, ChannelArgs arguments, + def __cinit__(self, bytes target, object arguments, ChannelCredentials channel_credentials=None): grpc_init() - cdef grpc_channel_args *c_arguments = NULL - cdef char *c_target = NULL - self.c_channel = NULL + self._vtable.copy = &_copy_pointer + self._vtable.destroy = &_destroy_pointer + self._vtable.cmp = &_compare_pointer + cdef _ArgumentsProcessor arguments_processor = _ArgumentsProcessor( + arguments) + cdef grpc_channel_args *c_arguments = arguments_processor.c(&self._vtable) self.references = [] - if len(arguments) > 0: - c_arguments = &arguments.c_args - self.references.append(arguments) c_target = target if channel_credentials is None: - with nogil: - self.c_channel = grpc_insecure_channel_create(c_target, c_arguments, - NULL) + self.c_channel = grpc_insecure_channel_create(c_target, c_arguments, NULL) else: c_channel_credentials = channel_credentials.c() self.c_channel = grpc_secure_channel_create( c_channel_credentials, c_target, c_arguments, NULL) grpc_channel_credentials_release(c_channel_credentials) + arguments_processor.un_c() self.references.append(target) self.references.append(arguments) |