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

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

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.14.0
    • 0.15.0, 0.14.1
    • Python - Library
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            spladug Neil Williams
            spladug Neil Williams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            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