Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1528

Inconsistency in optional fields between Java/C# and python

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.8
    • Fix Version/s: 1.0
    • Component/s: Python - Compiler
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                steff Stefan Gmeiner
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: