[ 
https://issues.apache.org/jira/browse/THRIFT-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James E. King III updated THRIFT-4810:
--------------------------------------
    Affects Version/s: 0.12.0

> PYTHON: deserialize does not work with python.immutable
> -------------------------------------------------------
>
>                 Key: THRIFT-4810
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4810
>             Project: Thrift
>          Issue Type: Bug
>    Affects Versions: 0.12.0
>            Reporter: Mathias Nisted Velling
>            Priority: Major
>
> Hi,
> In the python thrift implementation, the thrift.TSerialization.deserialize 
> does not work with structs that are marked as python.immutable.
> This is because deserialize(base, buf, protocol) assumes base is modified by 
> base.read(..), but due to the immutability, base.read(..) instead returns a a 
> new instance of type(base), so when deserialize returns base, it is still 
> just an empty object:
> {code:java}
> def deserialize(base,
>                 buf,
>                 protocol_factory=TBinaryProtocol.TBinaryProtocolFactory()):
>     transport = TTransport.TMemoryBuffer(buf)
>     protocol = protocol_factory.getProtocol(transport)
>     base.read(protocol)
>     return base{code}
>  
> It should probably instead just return the output of base.read(..):
> {code:java}
> def deserialize(base,
>                 buf,
>                 protocol_factory=TBinaryProtocol.TBinaryProtocolFactory()):
>     transport = TTransport.TMemoryBuffer(buf)
>     protocol = protocol_factory.getProtocol(transport)
>     return base.read(protocol){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to