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

Python compiler lose prefix while include typedef indirectly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.15.0
    • Fix Version/s: None
    • Component/s: Compiler (General)
    • Labels:
      None

      Description

       

      // a.thrift
      namespace py a
      struct Sample{
          //...
      }
       // b.thrift
      namespace py b
      typedef a.Sample AliasSample
      

       

       

       

      // c.thrift
      namespace py c
      include "b.thrift"
      struct Xxx {
          1: required b.AliasSample data
      }

       

      generate python code,  b.AliasSample is replaced with a.Sample(Unresolved reference), but c.py doesn`t include a.ttypes 

       

      // c.thrift
      from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
      from thrift.protocol.TProtocol import TProtocolException
      import sys
      import b.ttypes
      
      from thrift.transport import TTransport
      class Xxx(object):
      //...
          def read(self, iprot):
              if fid == 1:
                  if ftype == TType.STRUCT:
                      self.data = a.ttypes.Sample()
      //...
      
      Xxx.thrift_spec = (
          None,
          (1, TType.STRUCT, 'data', [a.ttypes.Sample, None], None, ), 
      )
      //...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ziwee Ziwei Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

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