thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4531) Thrift generates wrong Python code for immutable structures with optional members
Date Tue, 27 Mar 2018 11:34:00 GMT


ASF GitHub Bot commented on THRIFT-4531:

GitHub user margars opened a pull request:


    I am not familiar with your rules for contributions. This issue is described in JIRA THRIFT-4531.

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

    $ git pull master

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

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1520
commit d682b13e5e7672702e53f1e696263ef5293d8d37
Author: Margar Simonyan <margar.simonyan@...>
Date:   2018-03-27T11:22:10Z

    Fix the generated read() method for immutable structures with optional members.

commit 14a4c46c480ae041bb51397cefc9be575f17f79a
Author: Margar Simonyan <margar.simonyan@...>
Date:   2018-03-27T11:26:51Z

    Merge pull request #1 from margars/THRIFT-4531

commit 29289f4d8c88fee636b779a94aeae48bf81671b0
Author: Margar Simonyan <margar.simonyan@...>
Date:   2018-03-27T11:28:11Z

    Revert "Update"

commit 56dc4f04c20a9601063deec75630ff4212937a46
Author: Margar Simonyan <margar.simonyan@...>
Date:   2018-03-27T11:28:35Z

    Merge pull request #2 from margars/revert-1-THRIFT-4531
    Revert "Update"


> Thrift generates wrong Python code for immutable structures with optional members
> ---------------------------------------------------------------------------------
>                 Key: THRIFT-4531
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>    Affects Versions: 0.11.0
>            Reporter: Margar Simonyan
>            Priority: Major
> In order to make generated Python structs hashable one needs to add 
> ( python.immutable; )
> annotation. This is true for Python 3, in Python 2 technically the annotation is not
mandatory, however leads to undesirable situation, when equal objects have different hash
> If the struct has optional members, then the generated code for read(...) method is wrong
and results into undefined local variable error. To fix the issue these variables need to
be added to beginning of read(...) method and initialized to None or default values if available. 
> I have a patch for generate\ to fix the issue, but I am not familiar
with your procedures for contributors.

This message was sent by Atlassian JIRA

View raw message