You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Zach Steindler (JIRA)" <ji...@apache.org> on 2014/11/14 20:35:34 UTC

[jira] [Created] (THRIFT-2825) Supplying unicode to python Thrift client can cause request arguments to get overwritten

Zach Steindler created THRIFT-2825:
--------------------------------------

             Summary: Supplying unicode to python Thrift client can cause request arguments to get overwritten
                 Key: THRIFT-2825
                 URL: https://issues.apache.org/jira/browse/THRIFT-2825
             Project: Thrift
          Issue Type: Bug
            Reporter: Zach Steindler


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:

{noformat}
    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')
{noformat}

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

{noformat}
Example function called with second_call_arg1 second_call_arg2 second_call_arg3
{noformat}

But what I see is this:

{noformat}
Example function called with first_call_arg1 � None
{noformat}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)