You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2017/05/26 23:27:17 UTC

[1/2] beam git commit: Closes #3226

Repository: beam
Updated Branches:
  refs/heads/master b0fb5b24d -> 2994fce73


Closes #3226


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/2994fce7
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/2994fce7
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/2994fce7

Branch: refs/heads/master
Commit: 2994fce73c6fd7ce0e06ec867d09a940b368110b
Parents: b0fb5b2 86912a2
Author: Robert Bradshaw <ro...@gmail.com>
Authored: Fri May 26 16:27:09 2017 -0700
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Fri May 26 16:27:09 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/coders/coders.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[2/2] beam git commit: [BEAM-2365] Use the highest pickle protocol available.

Posted by ro...@apache.org.
[BEAM-2365] Use the highest pickle protocol available.


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/86912a23
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/86912a23
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/86912a23

Branch: refs/heads/master
Commit: 86912a23795353111934365ed9065a2a71f70074
Parents: b0fb5b2
Author: Robert Bradshaw <ro...@gmail.com>
Authored: Thu May 25 13:49:48 2017 -0700
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Fri May 26 16:27:09 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/coders/coders.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/86912a23/sdks/python/apache_beam/coders/coders.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/coders.py b/sdks/python/apache_beam/coders/coders.py
index ce914dd..f40045d 100644
--- a/sdks/python/apache_beam/coders/coders.py
+++ b/sdks/python/apache_beam/coders/coders.py
@@ -365,7 +365,7 @@ def maybe_dill_dumps(o):
   # We need to use the dill pickler for objects of certain custom classes,
   # including, for example, ones that contain lambdas.
   try:
-    return pickle.dumps(o)
+    return pickle.dumps(o, pickle.HIGHEST_PROTOCOL)
   except Exception:  # pylint: disable=broad-except
     return dill.dumps(o)
 
@@ -426,7 +426,10 @@ class PickleCoder(_PickleCoderBase):
   """Coder using Python's pickle functionality."""
 
   def _create_impl(self):
-    return coder_impl.CallbackCoderImpl(pickle.dumps, pickle.loads)
+    dumps = pickle.dumps
+    HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL
+    return coder_impl.CallbackCoderImpl(
+        lambda x: dumps(x, HIGHEST_PROTOCOL), pickle.loads)
 
 
 class DillCoder(_PickleCoderBase):
@@ -515,7 +518,7 @@ class Base64PickleCoder(Coder):
   # than via a special Coder.
 
   def encode(self, value):
-    return base64.b64encode(pickle.dumps(value))
+    return base64.b64encode(pickle.dumps(value, pickle.HIGHEST_PROTOCOL))
 
   def decode(self, encoded):
     return pickle.loads(base64.b64decode(encoded))