summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wojniak <kainjow@users.noreply.github.com>2022-01-22 20:10:26 -0800
committerJens Geyer <Jens-G@users.noreply.github.com>2022-03-05 09:58:27 +0100
commit8d6694d60787e2c5e16378e3738a4b31382b6834 (patch)
tree758f7bf02ca4d092fbc9b4b16072a3062caa6dd2
parentc4e5dbac2ad1c0020a58dae4968d0ac7dcc188f1 (diff)
downloadthrift-8d6694d60787e2c5e16378e3738a4b31382b6834.tar.gz
don't output empty import line if old style enums are used
-rw-r--r--compiler/cpp/src/thrift/generate/t_py_generator.cc6
1 files 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";
}