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

Supplying unicode to python Thrift client can cause next request arguments to get overwritten

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.3
    • Python - Library
    • None

    Description

      The python thrift client expects bytestrings instead of unicode. However, if you accidentally supply unicode instead of bytestrings it messes the arguments for the next thrift call on that client object, even if all the arguments are ASCII / bytestrings.

      For example, I have some python thrift client code that looks like this:

          try:
              client.example_function('first_call_arg1', u'☃', 'first_call_arg3')
          except UnicodeEncodeError:
              pass # This is what we expect to happen
      
          client.example_function('second_call_arg1', 'second_call_arg2', 'second_call_arg3')
      

      What I expect to see on the server side is this:

      Example function called with second_call_arg1 second_call_arg2 second_call_arg3
      

      But what I see is this:

      Example function called with first_call_arg1 � None
      

      I'm using the Thrift compiler version 0.9.2 and python thrift library version 0.9.1.

      Attachments

        1. thrift_example.tar.gz
          7 kB
          Zach Steindler

        Activity

          People

            roger Roger Meier
            steiza Zach Steindler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: