From 9eb1171dfb6f198b61336ca589c55442ab8dea59 Mon Sep 17 00:00:00 2001 From: Nikolai Lifanov Date: Thu, 21 Feb 2019 17:54:27 -0800 Subject: [PATCH] be compatible with Python 2 and Python 3 In Python 3, cc_err is going to be bytes(). --- src/python/grpcio/commands.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index e80b90c6a34..ca69527431f 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -33,6 +33,8 @@ from setuptools.command import test import support +from typing import Text + PYTHON_STEM = os.path.dirname(os.path.abspath(__file__)) GRPC_STEM = os.path.abspath(PYTHON_STEM + '../../../../') PROTO_STEM = os.path.join(GRPC_STEM, 'src', 'proto') @@ -222,7 +224,7 @@ class BuildExt(build_ext.build_ext): stdout=subprocess.PIPE, stderr=subprocess.PIPE) _, cc_err = cc_test.communicate(input='int main(){return 0;}') - return not 'invalid argument' in cc_err + return not 'invalid argument' in Text(cc_err) # This special conditioning is here due to difference of compiler # behavior in gcc and clang. The clang doesn't take --stdc++11