[ https://issues.apache.org/jira/browse/THRIFT-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15230118#comment-15230118 ]
ASF GitHub Bot commented on THRIFT-3783: ---------------------------------------- GitHub user collinmsn opened a pull request: https://github.com/apache/thrift/pull/982 THRIFT-3783: python code generator dose not handle struct dependent You can merge this pull request into a Git repository by running: $ git pull https://github.com/collinmsn/thrift master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/982.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #982 ---- commit d5de50526d476f234a452f4563531055ce943076 Author: zhenghuabin <zhenghua...@bytedance.com> Date: 2016-04-07T10:58:01Z gen py: generate struct types by dependent order ---- > python code generator dose not handle struct dependent > ------------------------------------------------------ > > Key: THRIFT-3783 > URL: https://issues.apache.org/jira/browse/THRIFT-3783 > Project: Thrift > Issue Type: Bug > Components: Python - Compiler > Reporter: Huabin > Priority: Minor > > given thrift idl > ``` > struct A { > 1: B b, > } > struct B { > 1: i32 b, > } > ``` > generated ttypes.py > ``` > 20 class A: > 21 """ > 22 Attributes: > 23 - b > 24 """ > 25 > 26 thrift_spec = ( > 27 None, # 0 > 28 (1, TType.STRUCT, 'b', (B, B.thrift_spec), None, ), # 1 > 29 ) > 30 > ``` > import A will cause error since it referenced B, which has not be defined. -- This message was sent by Atlassian JIRA (v6.3.4#6332)