summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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";
}