Merge pull request #19174 from lidizheng/expose-exception

Surface exception from metadata credentails plugin methods
pull/19183/head
Lidi Zheng 6 years ago committed by GitHub
commit f6f7ef60c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
  2. 4
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
  3. 4
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi

@ -26,9 +26,9 @@ cdef int _get_metadata(
grpc_credentials_plugin_metadata_cb cb, void *user_data, grpc_credentials_plugin_metadata_cb cb, void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status, size_t *num_creds_md, grpc_status_code *status,
const char **error_details) with gil const char **error_details) except * with gil
cdef void _destroy(void *state) with gil cdef void _destroy(void *state) except * with gil
cdef class MetadataPluginCallCredentials(CallCredentials): cdef class MetadataPluginCallCredentials(CallCredentials):

@ -42,7 +42,7 @@ cdef int _get_metadata(
grpc_credentials_plugin_metadata_cb cb, void *user_data, grpc_credentials_plugin_metadata_cb cb, void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status, size_t *num_creds_md, grpc_status_code *status,
const char **error_details) with gil: const char **error_details) except * with gil:
cdef size_t metadata_count cdef size_t metadata_count
cdef grpc_metadata *c_metadata cdef grpc_metadata *c_metadata
def callback(metadata, grpc_status_code status, bytes error_details): def callback(metadata, grpc_status_code status, bytes error_details):
@ -57,7 +57,7 @@ cdef int _get_metadata(
return 0 # Asynchronous return return 0 # Asynchronous return
cdef void _destroy(void *state) with gil: cdef void _destroy(void *state) except * with gil:
cpython.Py_DECREF(<object>state) cpython.Py_DECREF(<object>state)
grpc_shutdown_blocking() grpc_shutdown_blocking()

@ -546,8 +546,8 @@ cdef extern from "grpc/grpc_security.h":
grpc_credentials_plugin_metadata_cb cb, void *user_data, grpc_credentials_plugin_metadata_cb cb, void *user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
size_t *num_creds_md, grpc_status_code *status, size_t *num_creds_md, grpc_status_code *status,
const char **error_details) const char **error_details) except *
void (*destroy)(void *state) void (*destroy)(void *state) except *
void *state void *state
const char *type const char *type

Loading…
Cancel
Save