You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nate Rosenblum (Commented) (JIRA)" <ji...@apache.org> on 2012/03/01 18:04:04 UTC

[jira] [Commented] (THRIFT-1528) Iconsistency in optional fields between Java/C# and python

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

Nate Rosenblum commented on THRIFT-1528:
----------------------------------------

A similar inconsistency applies to C++ structures, where all optional fields that have default values are serialized (the isset predicate is initialized to true for such fields). These inconsistencies break applications that depend on consistency of serialized messages regardless of platform (e.g., computing HMAC on messages).
                
> Iconsistency in optional fields between Java/C# and python
> ----------------------------------------------------------
>
>                 Key: THRIFT-1528
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1528
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Compiler
>    Affects Versions: 0.8
>            Reporter: Stefan Gmeiner
>            Priority: Minor
>
> If a struct contains optional fields with default values the generated python code serialize differently than Java or C# code.
> In Java or C# optional fields are only serialized if a field was set by the client. If not the field is omited during serialization. This is possible because C#/Java maintains for each field a 'isset'-boolean which records if a field was set or not.
> However the generated python code does not have such a 'isset'-structure. It writes every field which is not equal None. As the constructor initialize the optional fields with their default value, these fields are written whether they are set or not.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira