You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King III (JIRA)" <ji...@apache.org> on 2019/02/22 15:11:00 UTC

[jira] [Commented] (THRIFT-4810) PYTHON: deserialize does not work with python.immutable

    [ https://issues.apache.org/jira/browse/THRIFT-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16775250#comment-16775250 ] 

James E. King III commented on THRIFT-4810:
-------------------------------------------

Can you submit a pull request for this?

> 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
>          Components: Python - Library
>    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)