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

David Reiss commented on THRIFT-339:
------------------------------------

Esteve: We should be able to go back to patch #5 if my solution to THRIFT-361 
is accepted.  Thanks for uncovering this bug!

Alexander: At the moment, I prefer the solution in Esteve's patch (I am also 
biased, because I tried to push him toward that implementation).  The main 
reason is that it is very low impact.  The old generated code will continue to 
work with the new extension and vice versa.  This version allows you to simply 
index into the thrift_spec list with the field id and have it work (without 
having to add an offset).  The limits are completely unnecessary as long as the 
data is assumed valid.  Finally, it allows users to set a field to None in the 
constructor, overriding the default.

> THRIFT-242 is incompatible with arguments with empty key fields
> ---------------------------------------------------------------
>
>                 Key: THRIFT-339
>                 URL: https://issues.apache.org/jira/browse/THRIFT-339
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Python)
>            Reporter: Jonathan Ellis
>         Attachments: thrift-339-2.patch, thrift-339-3.patch, 
> thrift-339-4.patch, thrift-339-5.patch, thrift-339-6.patch, thrift-339.patch, 
> thrift-python-defaults.patch
>
>
> Esteve's last change to how default values are stored broke stuff.  Here is a 
> quick example:
> {{
> service Test
> {
>   bool  get_slice(i32 start = -1),
> }
> }}
> generates
> {{
> class get_slice_args:
>   thrift_spec = None
>   def __init__(self, start=thrift_spec[-1][4],):
>     self.start = start
> }}
> which is obviously invalid.
> I'm not sure how thrift_spec is supposed to be populated here so I'm unsure 
> how to fix this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to