Commit ee814234 authored by Kirill Smelkov's avatar Kirill Smelkov

X Switch ZODB5 to use protocol=1

It works, at least on Python2.
parent bc13ca74
...@@ -11,13 +11,14 @@ ...@@ -11,13 +11,14 @@
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
from zodbpickle import binary # noqa: F401 import unused #from zodbpickle import binary # noqa: F401 import unused
binary = bytes
import sys import sys
from six import PY3 from six import PY3
IS_JYTHON = sys.platform.startswith('java') IS_JYTHON = sys.platform.startswith('java')
_protocol = 3 _protocol = 1
if not PY3: if not PY3:
# Python 2.x # Python 2.x
......
...@@ -145,7 +145,7 @@ class SerializerTestCase(unittest.TestCase): ...@@ -145,7 +145,7 @@ class SerializerTestCase(unittest.TestCase):
pickle = serialize.ObjectWriter().serialize(top) pickle = serialize.ObjectWriter().serialize(top)
# Make sure the persistent id is pickled using the 'C', # Make sure the persistent id is pickled using the 'C',
# SHORT_BINBYTES opcode: # SHORT_BINBYTES opcode:
self.assertTrue(b'C\x04abcd' in pickle) #self.assertTrue(b'C\x04abcd' in pickle) # disabled: we set protocol=1
refs = [] refs = []
u = PersistentUnpickler(None, refs.append, BytesIO(pickle)) u = PersistentUnpickler(None, refs.append, BytesIO(pickle))
...@@ -154,7 +154,7 @@ class SerializerTestCase(unittest.TestCase): ...@@ -154,7 +154,7 @@ class SerializerTestCase(unittest.TestCase):
self.assertEqual(refs, [['w', (b'abcd',)]]) self.assertEqual(refs, [['w', (b'abcd',)]])
def test_protocol_3_binary_handling(self): def _test_protocol_3_binary_handling(self): # disabled: we set protocol=1
from ZODB.serialize import _protocol from ZODB.serialize import _protocol
self.assertEqual(3, _protocol) # Yeah, whitebox self.assertEqual(3, _protocol) # Yeah, whitebox
o = PersistentObject() o = PersistentObject()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment