You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2022/03/05 08:58:43 UTC

[thrift] 06/08: don't output empty import line if old style enums are used

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit 8d6694d60787e2c5e16378e3738a4b31382b6834
Author: Kevin Wojniak <ka...@users.noreply.github.com>
AuthorDate: Sat Jan 22 20:10:26 2022 -0800

    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 f330b50..4457871 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";
   }