GitHub user johnlockwood-wf opened a pull request:
https://github.com/apache/thrift/pull/756
THRIFT-3500: Strings unicode py2
As the test shows this makes Thrift protocols treat Strings as unicode in
Python 2 which is essentially equivalent as the str in Python 3. Indeed Python
3.5 now treats u"hello" as a str literal, just as Python 2 treats it as a
unicode literal.
The python 2 standard lib contains the json package, that, when loading
JSON, deserializes strings into unicode objects, where the TJSONProtocol
deserializes them into utf-8 encoded bytes without this change.
https://issues.apache.org/jira/browse/THRIFT-3500
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/johnlockwood-wf/thrift strings-unicode-py2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/756.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #756
----
commit dfd8f2b6f9d283b74d4b59d9ec0899d63f54402a
Author: John.Lockwood <[email protected]>
Date: 2015-12-20T01:12:59Z
Make a String type come from a JSON String.
JSON String is equivalent to unicode in Py2
and str Py3
Expect the type being transformed into JSON String
is either ASCII str or unicode in Py2 and
str in Py3.
commit 1ebbed5fea9c23f3312f5a7adb160c7bc9c842fb
Author: John.Lockwood <[email protected]>
Date: 2015-12-20T01:39:48Z
Improve the string/binary compatibility functions
This makes them concept equivalent across Py2/Py3
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---