THRIFT-3230: transform typedef when getting type name

Client: Python
Patch: 软件工程师李飛 <lifei@7v1.net>

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.
This commit is contained in:
Jens Geyer 2015-07-11 11:41:32 +02:00
parent 90c60e340c
commit 01a77ab01e

View File

@ -2339,6 +2339,10 @@ string t_py_generator::argument_list(t_struct* tstruct, vector<string>* 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();