From f16f305904908a9b807b7d6388f36c00455f39b3 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Fri, 30 Jun 2023 15:30:28 +0800 Subject: [PATCH] THRIFT-5720: Encode binary args in Python remote --- compiler/cpp/src/thrift/generate/t_py_generator.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc index 7063ab21e49..71078699043 100644 --- a/compiler/cpp/src/thrift/generate/t_py_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc @@ -1799,7 +1799,9 @@ void t_py_generator::generate_service_remote(t_service* tservice) { first_arg = false; else f_remote << " "; - if (args[i]->get_type()->is_string()) { + if (args[i]->get_type()->is_binary()) { + f_remote << "args[" << i << "].encode('utf-8'),"; + } else if (args[i]->get_type()->is_string()) { f_remote << "args[" << i << "],"; } else { f_remote << "eval(args[" << i << "]),";