You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2017/05/12 14:41:04 UTC

[jira] [Comment Edited] (THRIFT-2642) Recursive structs don't work in python

    [ https://issues.apache.org/jira/browse/THRIFT-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16008223#comment-16008223 ] 

Jens Geyer edited comment on THRIFT-2642 at 5/12/17 2:40 PM:
-------------------------------------------------------------

[~allengeorge], 

I am fine with it as long as 
- the proposed changes are local to Python stuff (.i.e. there are no changes necessary that affect other languages or question the infrastructure in general) 
- [~lyschoening], [~myTalala], [~econner724], [~isanych] and [~juliengreard] agree with your pull request
- all builds are fine

I can surely do a general review, but my Python expertise is limited, so I would not rely on my own opinion alone. Especially not with such a topic. But if you 5 guys come to someething you are happy with as a group, we should have enough backing to get it merged.  At the end, this is open source.



was (Author: jensg):
[~allengeorge], 

I am fine with it as long as 
a) the proposed changes are local to Python stuff (.i.e. there are no changes necessary that affect other languages or question the infrastructure in general) 
b) if [~lyschoening], [~myTalala], [~econner724] and [~juliengreard] agree with your pull request
c) all builds are fine

I can surely do a general review, but my Python expertise is limited, so I would not rely on my own opinion alone. Especially not with such a topic. But if you 5 guys come to someething you are happy with as a group, we should have enough backing to get it merged.  At the end, this is open source.


> 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.15#6346)