diff options
author | 2018-11-21 15:30:44 -0800 | |
---|---|---|
committer | 2018-11-26 10:15:14 -0800 | |
commit | b7fd18daa469057d9dabc6787729fc746cca317c (patch) | |
tree | 99503bdd203295b8e3a0dbe55276660979ae9a40 /src/python/grpcio/grpc/_cython/_cygrpc | |
parent | b32d8f5d4d99c5f94f970881ef9d8858eb52bbbc (diff) |
Raise the exception while credential initialization
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc')
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 63048e8da0..ff523fb256 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -129,6 +129,8 @@ cdef class SSLSessionCacheLRU: cdef class SSLChannelCredentials(ChannelCredentials): def __cinit__(self, pem_root_certificates, private_key, certificate_chain): + if pem_root_certificates is not None and not isinstance(pem_root_certificates, bytes): + raise TypeError('expected certificate to be bytes, got %s' % (type(pem_root_certificates))) self._pem_root_certificates = pem_root_certificates self._private_key = private_key self._certificate_chain = certificate_chain |