[ 
https://issues.apache.org/jira/browse/THRIFT-1229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim updated THRIFT-1229:
------------------------

    Attachment: python_fastbinary_utf8_binary.patch

I've attached a version building on top of the original patch and implementing 
the said suggestion to add binary support through the thrift_spec. I too 
haven't done much python c-api extension coding (or C coding itself for that 
matter) but hope this is helpful.

This patch will make thrift code generated with previous versions of thrift 
incompatible with fastbinary (ie, code will need to be regenerated). This could 
be modified so that compatibility is maintained, but I'm not sure whether 
that's a requirement or not.  


> Python fastbinary.c can not handle unicode as generated python code
> -------------------------------------------------------------------
>
>                 Key: THRIFT-1229
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1229
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Compiler, Python - Library
>    Affects Versions: 0.7
>         Environment: mac osx 10.6
>            Reporter: Favo
>         Attachments: python_fastbinary_utf8.patch, 
> python_fastbinary_utf8_binary.patch
>
>
> #THRIFT-395 
> ([r959516|http://svn.apache.org/viewvc?view=revision&revision=959516]) fixed 
> python unicode support by adding a parameter to thrift command line for 
> py-generator. However this will not affect fastbinary.c. A normal generated 
> Read/Write function looks like below, notice that the function returned 
> before reach unicode handling logic.
> {code:title=TType.py|borderStyle=solid}
>   def write(self, oprot):
>     if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and 
> self.thrift_spec is not None and fastbinary is not None:
>       oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, 
> self.thrift_spec)))
>       return
>     if self.ip is not None:
>       oprot.writeFieldBegin('ip', TType.STRING, 6)
>       oprot.writeString(self.ip.encode('utf-8'))
>       oprot.writeFieldEnd()
> {code}
> Any suggestion for this?



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to