aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2017-09-29 08:45:31 -0700
committerGravatar GitHub <noreply@github.com>2017-09-29 08:45:31 -0700
commit87997edd45e3e4de1f5ec09e79acc8d671a42a5a (patch)
treea00ce4673ec7102cdd872084073bdac7df8b521f
parentede8ed215603add55479e70407c59b0a62130f89 (diff)
parent103991eb73aba3cd4cf9b58f7fca963404233148 (diff)
Merge pull request #12765 from nathanielmanistaatgoogle/cython
Devolve staticmethod to ordinary function.
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi3
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi22
2 files changed, 13 insertions, 12 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
index 98f306feb7..41975cbe9e 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
@@ -41,7 +41,8 @@ cdef class CredentialsMetadataPlugin:
cdef object plugin_callback
cdef bytes plugin_name
- cdef grpc_metadata_credentials_plugin make_c_plugin(self)
+
+cdef grpc_metadata_credentials_plugin _c_plugin(CredentialsMetadataPlugin plugin)
cdef class AuthMetadataContext:
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
index f73dbe4a9d..0fabda19ce 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
@@ -90,20 +90,20 @@ cdef class CredentialsMetadataPlugin:
self.plugin_callback = plugin_callback
self.plugin_name = name
- @staticmethod
- cdef grpc_metadata_credentials_plugin make_c_plugin(self):
- cdef grpc_metadata_credentials_plugin result
- result.get_metadata = plugin_get_metadata
- result.destroy = plugin_destroy_c_plugin_state
- result.state = <void *>self
- result.type = self.plugin_name
- cpython.Py_INCREF(self)
- return result
-
def __dealloc__(self):
grpc_shutdown()
+cdef grpc_metadata_credentials_plugin _c_plugin(CredentialsMetadataPlugin plugin):
+ cdef grpc_metadata_credentials_plugin c_plugin
+ c_plugin.get_metadata = plugin_get_metadata
+ c_plugin.destroy = plugin_destroy_c_plugin_state
+ c_plugin.state = <void *>plugin
+ c_plugin.type = plugin.plugin_name
+ cpython.Py_INCREF(plugin)
+ return c_plugin
+
+
cdef class AuthMetadataContext:
def __cinit__(self):
@@ -246,7 +246,7 @@ def call_credentials_google_iam(authorization_token, authority_selector):
def call_credentials_metadata_plugin(CredentialsMetadataPlugin plugin):
cdef CallCredentials credentials = CallCredentials()
- cdef grpc_metadata_credentials_plugin c_plugin = plugin.make_c_plugin()
+ cdef grpc_metadata_credentials_plugin c_plugin = _c_plugin(plugin)
with nogil:
credentials.c_credentials = (
grpc_metadata_credentials_create_from_plugin(c_plugin, NULL))