[
https://issues.apache.org/jira/browse/THRIFT-5366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ziwei Wang updated THRIFT-5366:
-------------------------------
Description:
{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(Unresolved
reference), 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}
was:
{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}
> 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
> Components: Compiler (General)
> Affects Versions: 0.15.0
> Reporter: Ziwei Wang
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
>
> {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(Unresolved
> reference), 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)