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

SystemError when using fast binary or compact protocol in python 3.10

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.15.0
    • 0.16.0
    • Python - Library
    • None

    Description

      Up till python 3.9  a DeprecationWarning was raised when '#' formats were used without defining PY_SSIZE_T_CLEAN:

       

      DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
        iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) 

       

      Starting with python 3.10 this now becomes a runtime SystemError. Details of change: Python bug tracker 40943

      This specifically gets exercised in the c python extension module in ProtocolBase<Impl>::readBytes (src/protocol.tcc) when falling back to the building function.

      An easy way to reproduce the error is to pass an empty byte array to the TSerializer.deserialize method, for example:

        buf = TTransport.TMemoryBuffer()
        transport = TTransport.TBufferedTransportFactory().getTransport(buf)
        factory = TBinaryProtocolAcceleratedFactory(transport)
        TSerialization.deserialize(Message(), b'', factory) #  Message is a thrift struct. This raises a SystemError in python 3.10+

      Attachments

        Issue Links

          Activity

            People

              alisaifee Ali-Akber Saifee
              alisaifee Ali-Akber Saifee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h
                  3h