From 01a77ab01e7459d96059a2b49d9885d14a360ef1 Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Sat, 11 Jul 2015 11:41:32 +0200 Subject: [PATCH] =?UTF-8?q?THRIFT-3230:=20transform=20typedef=20when=20get?= =?UTF-8?q?ting=20type=20name=20Client:=20Python=20Patch:=20=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E7=A8=8B=E5=B8=88=E6=9D=8E=E9=A3=9B=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This closes #545 Python compiler generates wrong code if there is function throwing a typedef of exception with another namespace. We should use the real type name instead of the name of typedef. --- compiler/cpp/src/generate/t_py_generator.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc index 08a3536b5..2002c1e28 100644 --- a/compiler/cpp/src/generate/t_py_generator.cc +++ b/compiler/cpp/src/generate/t_py_generator.cc @@ -2339,6 +2339,10 @@ string t_py_generator::argument_list(t_struct* tstruct, vector* pre, vec } string t_py_generator::type_name(t_type* ttype) { + while (ttype->is_typedef()) { + ttype = ((t_typedef*)ttype)->get_type(); + } + t_program* program = ttype->get_program(); if (ttype->is_service()) { return get_real_py_module(program, gen_twisted_) + "." + ttype->get_name();