[ https://issues.apache.org/jira/browse/THRIFT-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14540703#comment-14540703 ]
Jens Geyer edited comment on THRIFT-2642 at 5/12/15 8:54 PM: ------------------------------------------------------------- Hi, there is a "help" icon which lists all the possible formattings. Any chance that you could create a patch out of your findings and/or workaround for the Python generator? We accept patch files and pull requests, see [here|http://thrift.apache.org/docs/HowToContribute] for details. was (Author: jensg): Hi, there is a "help" icon which lists all the possible formattings. Any chance that you coulod create a patch out of your findings and/or workaround, or does that make no sense? > Recursive structs don't work in python > -------------------------------------- > > Key: THRIFT-2642 > URL: https://issues.apache.org/jira/browse/THRIFT-2642 > Project: Thrift > Issue Type: Bug > Components: Python - Compiler, Python - Library > Affects Versions: 0.9.2 > Reporter: Igor Kostenko > > Recursive structs in 0.9.2 work fine in c++ & c#, but not in python, because > generated code trying to use objects which not constructed yet. > Struct: > {code} > struct Recursive { > 1: list<Recursive> Children > } > {code} > Python code: > {code} > class Recursive: > thrift_spec = ( > None, # 0 > (1, TType.LIST, 'Children', (TType.STRUCT,(Recursive, > Recursive.thrift_spec)), None, ), # 1 > ) > {code} > Error message: > {code} > Traceback (most recent call last): > File "ttypes.py", line 20, in <module> > class Recursive: > File "ttypes.py", line 28, in Recursive > (1, TType.LIST, 'Children', (TType.STRUCT,(Recursive, > Recursive.thrift_spec)), None, ), # 1 > NameError: name 'Recursive' is not defined > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)