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

Python fastbinary.c can not handle unicode as generated python code

    XMLWordPrintableJSON

Details

    Description

      #THRIFT-395 (r959516) 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.

      TType.py
        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()
      

      Any suggestion for this?

      Attachments

        1. thrift-1229-fastbinary-utf8-v3.patch
          4 kB
          James Haggerty
        2. python_fastbinary_utf8_binary.patch
          12 kB
          Tim
        3. python_fastbinary_utf8.patch
          11 kB
          bnewbold

        Issue Links

          Activity

            People

              nsuke Nobuaki Sukegawa
              favoyang Favo
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: