Fix gil relinquishment

pull/21458/head
Richard Belleville 5 years ago
parent 1f53f13446
commit 1f655ad351
  1. 7
      tools/distrib/python/grpcio_tools/grpc_tools/_protoc_compiler.pyx

@ -37,8 +37,8 @@ cdef extern from "grpc_tools/main.h" namespace "grpc_tools":
string message string message
int protoc_main(int argc, char *argv[]) int protoc_main(int argc, char *argv[])
int protoc_get_protos(char* protobuf_path, vector[string]* include_path, vector[pair[string, string]]* files_out, vector[cProtocError]* errors, vector[cProtocWarning]* wrnings) except + int protoc_get_protos(char* protobuf_path, vector[string]* include_path, vector[pair[string, string]]* files_out, vector[cProtocError]* errors, vector[cProtocWarning]* wrnings) nogil except +
int protoc_get_services(char* protobuf_path, vector[string]* include_path, vector[pair[string, string]]* files_out, vector[cProtocError]* errors, vector[cProtocWarning]* wrnings) except + int protoc_get_services(char* protobuf_path, vector[string]* include_path, vector[pair[string, string]]* files_out, vector[cProtocError]* errors, vector[cProtocWarning]* wrnings) nogil except +
def run_main(list args not None): def run_main(list args not None):
cdef char **argv = <char **>stdlib.malloc(len(args)*sizeof(char *)) cdef char **argv = <char **>stdlib.malloc(len(args)*sizeof(char *))
@ -109,8 +109,7 @@ def get_protos(bytes protobuf_path, list include_paths):
cdef vector[cProtocError] errors cdef vector[cProtocError] errors
# NOTE: Abbreviated name used to avoid shadowing of the module name. # NOTE: Abbreviated name used to avoid shadowing of the module name.
cdef vector[cProtocWarning] wrnings cdef vector[cProtocWarning] wrnings
with nogil: rc = protoc_get_protos(protobuf_path, &c_include_paths, &files, &errors, &wrnings)
rc = protoc_get_protos(protobuf_path, &c_include_paths, &files, &errors, &wrnings)
_handle_errors(rc, &errors, &wrnings, protobuf_path) _handle_errors(rc, &errors, &wrnings, protobuf_path)
return files return files

Loading…
Cancel
Save