You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ziwei Wang (Jira)" <ji...@apache.org> on 2021/03/08 13:21:00 UTC
[jira] [Created] (THRIFT-5366) Python compiler lose prefix while
include typedef indirectly
Ziwei Wang created THRIFT-5366:
----------------------------------
Summary: Python compiler lose prefix while include typedef indirectly
Key: THRIFT-5366
URL: https://issues.apache.org/jira/browse/THRIFT-5366
Project: Thrift
Issue Type: Bug
Affects Versions: 0.15.0
Reporter: Ziwei Wang
{code:java}
// a.thrift
namespace py a
struct Sample{
//...
}{code}
{code:java}
// b.thrift
namespace py b
typedef a.Sample AliasSample
{code}
{code:java}
// c.thrift
namespace py c
include "b.thrift"
struct Xxx {
1: required b.AliasSample data
}{code}
generate python code, b.AliasSample is replaced with a.Sample, but c.py doesn`t include a.ttypes
{code:java}
// 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, ),
)
//...{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)