From 8d6694d60787e2c5e16378e3738a4b31382b6834 Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Sat, 22 Jan 2022 20:10:26 -0800 Subject: don't output empty import line if old style enums are used --- compiler/cpp/src/thrift/generate/t_py_generator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc index f330b5092..4457871ff 100644 --- a/compiler/cpp/src/thrift/generate/t_py_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc @@ -467,10 +467,10 @@ string t_py_generator::py_imports() { << "from thrift.protocol.TProtocol import TProtocolException" << endl << "from thrift.TRecursive import fix_spec" - << endl - << (gen_enum_ ? "from enum import IntEnum" : "") << endl; - + if (gen_enum_) { + ss << "from enum import IntEnum" << endl; + } if (gen_utf8strings_) { ss << endl << "import sys"; } -- cgit v1.2.1