[
https://issues.apache.org/jira/browse/THRIFT-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672789#action_12672789
]
Esteve Fernandez commented on THRIFT-339:
-----------------------------------------
I spoke too early, it seems my patch DID actually break things :-) Here's the
code that an old compiler generates:
thrift_spec = None
def __init__(self, d=None):
self.start = -1
if isinstance(d, dict):
if 'start' in d:
self.start = d['start']
so, unless we always generate thrift_spec or we use a sentinel, I don't know if
this can be fixed. However, I wonder how the fastbinary extension could work if
thrift_spec is None. I can change the compiler to generate the thrift_spec
variable no matter what, but would like to hear the opinion of others.
> the compiler should abort (or warn) if an argument doesn't have a field key
> ---------------------------------------------------------------------------
>
> Key: THRIFT-339
> URL: https://issues.apache.org/jira/browse/THRIFT-339
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (Python)
> Reporter: Jonathan Ellis
>
> 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.