You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/21 01:56:00 UTC

[jira] [Commented] (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=16056825#comment-16056825 ] 

ASF GitHub Bot commented on THRIFT-2642:
----------------------------------------

GitHub user econner opened a pull request:

    https://github.com/apache/thrift/pull/1293

    THRIFT-2642 Recursive structs don't work in python

    See https://issues.apache.org/jira/browse/THRIFT-2642.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/econner/thrift master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/1293.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 #1293
    
----
commit d62798144b68353c8def2e80388b9ae5e368e9fb
Author: Eric Conner <er...@pinterest.com>
Date:   2017-06-21T01:34:12Z

    THRIFT-2642 Recursive structs don't work in python
    
    See https://issues.apache.org/jira/browse/THRIFT-2642.

----


> 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.4.14#64029)