You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/06/19 17:37:16 UTC

[arrow] branch master updated: ARROW-4675: [Python] Fix pyarrow.deserialize failure when reading payload in Python 3 payload generated in Python 2

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 831774b  ARROW-4675: [Python] Fix pyarrow.deserialize failure when reading payload in Python 3 payload generated in Python 2
831774b is described below

commit 831774b51cf7f74a88059bfbb6c9cc56d65a8554
Author: Wes McKinney <we...@apache.org>
AuthorDate: Wed Jun 19 12:37:08 2019 -0500

    ARROW-4675: [Python] Fix pyarrow.deserialize failure when reading payload in Python 3 payload generated in Python 2
    
    I'm not sure how to unit test this.
    
    Author: Wes McKinney <we...@apache.org>
    
    Closes #4611 from wesm/ARROW-4675 and squashes the following commits:
    
    85c458598 <Wes McKinney> Decode bytes generated by Python 2 when deserializing in Python 3
---
 python/pyarrow/serialization.pxi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/pyarrow/serialization.pxi b/python/pyarrow/serialization.pxi
index 04149af..cb463dd 100644
--- a/python/pyarrow/serialization.pxi
+++ b/python/pyarrow/serialization.pxi
@@ -19,7 +19,7 @@ from cpython.ref cimport PyObject
 
 import six
 
-from pyarrow.compat import pickle
+from pyarrow.compat import frombytes, pickle
 
 
 def is_named_tuple(cls):
@@ -165,6 +165,9 @@ cdef class SerializationContext:
 
     def _deserialize_callback(self, serialized_obj):
         type_id = serialized_obj["_pytype_"]
+        if isinstance(type_id, bytes):
+            # ARROW-4675: Python 2 serialized, read in Python 3
+            type_id = frombytes(type_id)
 
         if "pickle" in serialized_obj:
             # The object was pickled, so unpickle it.