thrift-dev mailing list archives

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

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

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

Github user margars commented on the issue:

    https://github.com/apache/thrift/pull/1520
  
    Sorry, I am not familiar with all this setup and rules.


> Thrift generates wrong Python code for immutable structures with optional members
> ---------------------------------------------------------------------------------
>
>                 Key: THRIFT-4531
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4531
>             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
values.
> 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\t_py_generator.cc to fix the issue, but I am not familiar
with your procedures for contributors.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message