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

Python: IDL exceptions with no fields can't be instantiated

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.14.0
    • Fix Version/s: 0.15.0, 0.14.1
    • Component/s: Python - Library
    • Labels:
      None

      Description

      $ 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.

        Attachments

          Activity

            People

            • Assignee:
              spladug Neil Williams
              Reporter:
              spladug Neil Williams

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                  Issue deployment