[
https://issues.apache.org/jira/browse/THRIFT-5352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer closed THRIFT-5352.
------------------------------
> Python: IDL exceptions with no fields can't be instantiated
> -----------------------------------------------------------
>
> Key: THRIFT-5352
> URL: https://issues.apache.org/jira/browse/THRIFT-5352
> Project: Thrift
> Issue Type: Bug
> Components: Python - Library
> Affects Versions: 0.14.0
> Reporter: Neil Williams
> Assignee: Neil Williams
> Priority: Major
> Fix For: 0.15.0, 0.14.1
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> {{$ thrift --version}}
> {{Thrift version 0.14.0}}
> {{}}{{$ pip freeze | grep thrift}}
> {{thrift==0.14.0}}
> {{$ cat test.thrift}}
> {{exception LookMaNoFields {}}}
> {{$ thrift -out . -gen py test.thrift}}{{$ python}}
> {{>>> from test.ttypes import LookMaNoFields}}
> {{>>> LookMaNoFields()}}
> {{Traceback (most recent call last):}}
> {{ File "<stdin>", line 1, in <module>}}
> {{ File "/src/thrift/lib/py/thrift/Thrift.py", line 93, in __init__}}
> {{ super(TException, self).__setattr__("message", message)}}
> {{ File "/src/example/test/ttypes.py", line 23, in __setattr__}}
> {{ raise TypeError("can't modify immutable instance")}}
> {{TypeError: can't modify immutable instance}}
>
> This appears to be related to the changes in THRIFT-4002. In the case where
> there are no fields, no special constructor gets created and we fall back to
> TException's base constructor which tries to set the message attribute on the
> instance.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)