Merge pull request #20314 from robertwb/scope-fixes

Fix issue with exception being out of scope in Python 3.
pull/20973/head
Richard Belleville 5 years ago committed by GitHub
commit d0937d101e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/resolver.pyx.pxi
  2. 3
      src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/socket.pyx.pxi

@ -35,6 +35,7 @@ cdef class _AsyncioResolver:
res = future.result()
except Exception as e:
error = True
error_msg = str(e)
finally:
self._task_resolve = None
@ -48,7 +49,7 @@ cdef class _AsyncioResolver:
grpc_custom_resolve_callback(
<grpc_custom_resolver*>self._grpc_resolver,
NULL,
grpc_socket_error("getaddrinfo {}".format(str(e)).encode())
grpc_socket_error("getaddrinfo {}".format(error_msg).encode())
)
cdef void resolve(self, char* host, char* port):

@ -61,6 +61,7 @@ cdef class _AsyncioSocket:
self._reader, self._writer = future.result()
except Exception as e:
error = True
error_msg = str(e)
finally:
self._task_connect = None
@ -77,7 +78,7 @@ cdef class _AsyncioSocket:
else:
self._grpc_connect_cb(
<grpc_custom_socket*>self._grpc_socket,
grpc_socket_error("connect {}".format(str(e)).encode())
grpc_socket_error("connect {}".format(error_msg).encode())
)
def _read_cb(self, future):

Loading…
Cancel
Save