Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
1b21b3a8
Commit
1b21b3a8
authored
Mar 28, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pickle protocol 3 on the wire.
parent
b823ccde
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
42 deletions
+37
-42
CHANGES.rst
CHANGES.rst
+5
-1
src/ZEO/_compat.py
src/ZEO/_compat.py
+10
-3
src/ZEO/asyncio/marshal.py
src/ZEO/asyncio/marshal.py
+12
-19
src/ZEO/tests/ZEO4/zrpc/marshal.py
src/ZEO/tests/ZEO4/zrpc/marshal.py
+7
-18
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+3
-1
No files found.
CHANGES.rst
View file @
1b21b3a8
Changelog
Changelog
=========
=========
5.
1.3
(unreleased)
5.
2.0
(unreleased)
------------------
------------------
- Fix ``ZEO.server`` relying on test dependencies. See `issue 105
- Fix ``ZEO.server`` relying on test dependencies. See `issue 105
...
@@ -20,6 +20,10 @@ Changelog
...
@@ -20,6 +20,10 @@ Changelog
had ``zodbpickle.binary`` OIDs. See `issue 113
had ``zodbpickle.binary`` OIDs. See `issue 113
<https://github.com/zopefoundation/ZEO/issues/113>`_.
<https://github.com/zopefoundation/ZEO/issues/113>`_.
- ZEO now uses pickle protocol 3 for both Python 2 and Python 3.
(Previously protocol 1 was used for Python 2.) This matches the
change in ZODB 5.4.0.
5.1.2 (2018-03-27)
5.1.2 (2018-03-27)
------------------
------------------
...
...
src/ZEO/_compat.py
View file @
1b21b3a8
...
@@ -22,7 +22,7 @@ PYPY = getattr(platform, 'python_implementation', lambda: None)() == 'PyPy'
...
@@ -22,7 +22,7 @@ PYPY = getattr(platform, 'python_implementation', lambda: None)() == 'PyPy'
WIN
=
sys
.
platform
.
startswith
(
'win'
)
WIN
=
sys
.
platform
.
startswith
(
'win'
)
if
PY3
:
if
PY3
:
from
pickle
import
Pickler
,
Unpickler
as
_Unpickler
,
dump
,
dumps
,
loads
from
zodbpickle.
pickle
import
Pickler
,
Unpickler
as
_Unpickler
,
dump
,
dumps
,
loads
class
Unpickler
(
_Unpickler
):
class
Unpickler
(
_Unpickler
):
# Py3: Python 3 doesn't allow assignments to find_global,
# Py3: Python 3 doesn't allow assignments to find_global,
# instead, find_class can be overridden
# instead, find_class can be overridden
...
@@ -34,8 +34,15 @@ if PY3:
...
@@ -34,8 +34,15 @@ if PY3:
return
super
(
Unpickler
,
self
).
find_class
(
modulename
,
name
)
return
super
(
Unpickler
,
self
).
find_class
(
modulename
,
name
)
return
self
.
find_global
(
modulename
,
name
)
return
self
.
find_global
(
modulename
,
name
)
else
:
else
:
# Pickle support
try
:
from
cPickle
import
Pickler
,
Unpickler
,
dump
,
dumps
,
loads
import
zodbpickle.fastpickle
as
cPickle
except
ImportError
:
import
zodbpickle.pickle
as
cPickle
Pickler
=
cPickle
.
Pickler
Unpickler
=
cPickle
.
Unpickler
dump
=
cPickle
.
dump
dumps
=
cPickle
.
dumps
loads
=
cPickle
.
loads
# String and Bytes IO
# String and Bytes IO
from
ZODB._compat
import
BytesIO
from
ZODB._compat
import
BytesIO
...
...
src/ZEO/asyncio/marshal.py
View file @
1b21b3a8
...
@@ -42,25 +42,18 @@ def encoder(protocol, server=False):
...
@@ -42,25 +42,18 @@ def encoder(protocol, server=False):
else
:
else
:
assert
protocol
[:
1
]
==
b'Z'
assert
protocol
[:
1
]
==
b'Z'
if
PY3
or
PYPY
:
f
=
BytesIO
()
f
=
BytesIO
()
getvalue
=
f
.
getvalue
getvalue
=
f
.
getvalue
seek
=
f
.
seek
seek
=
f
.
seek
truncate
=
f
.
truncate
truncate
=
f
.
truncate
pickler
=
Pickler
(
f
,
3
)
pickler
=
Pickler
(
f
,
3
if
PY3
else
1
)
pickler
.
fast
=
1
pickler
.
fast
=
1
dump
=
pickler
.
dump
dump
=
pickler
.
dump
def
encode
(
*
args
):
def
encode
(
*
args
):
seek
(
0
)
seek
(
0
)
truncate
()
truncate
()
dump
(
args
)
dump
(
args
)
return
getvalue
()
return
getvalue
()
else
:
pickler
=
Pickler
(
1
)
pickler
.
fast
=
1
dump
=
pickler
.
dump
def
encode
(
*
args
):
return
dump
(
args
,
2
)
return
encode
return
encode
...
...
src/ZEO/tests/ZEO4/zrpc/marshal.py
View file @
1b21b3a8
...
@@ -32,24 +32,13 @@ def encode(*args): # args: (msgid, flags, name, args)
...
@@ -32,24 +32,13 @@ def encode(*args): # args: (msgid, flags, name, args)
# being represented by \xij escapes in proto 0).
# being represented by \xij escapes in proto 0).
# Undocumented: cPickle.Pickler accepts a lone protocol argument;
# Undocumented: cPickle.Pickler accepts a lone protocol argument;
# pickle.py does not.
# pickle.py does not.
if
PY3
:
# XXX: Py3: Needs optimization.
# XXX: Py3: Needs optimization.
f
=
BytesIO
()
f
=
BytesIO
()
pickler
=
Pickler
(
f
,
3
)
pickler
=
Pickler
(
f
,
3
)
pickler
.
fast
=
1
pickler
.
fast
=
1
pickler
.
dump
(
args
)
pickler
.
dump
(
args
)
res
=
f
.
getvalue
()
res
=
f
.
getvalue
()
return
res
return
res
else
:
pickler
=
Pickler
(
1
)
pickler
.
fast
=
1
# Only CPython's cPickle supports dumping
# and returning in one operation:
# return pickler.dump(args, 1)
# For PyPy we must return the value; fortunately this
# works the same on CPython and is no more expensive
pickler
.
dump
(
args
)
return
pickler
.
getvalue
()
...
...
src/ZEO/tests/testZEO.py
View file @
1b21b3a8
...
@@ -487,7 +487,9 @@ class ClientConflictResolutionTests(
...
@@ -487,7 +487,9 @@ class ClientConflictResolutionTests(
return
'<mappingstorage>
\
n
</mappingstorage>
\
n
'
return
'<mappingstorage>
\
n
</mappingstorage>
\
n
'
def
getZEOConfig
(
self
):
def
getZEOConfig
(
self
):
return
forker
.
ZEOConfig
((
''
,
0
),
client_conflict_resolution
=
True
)
# Using '' can result in binding to :: and cause problems
# connecting to the MTAcceptor on Travis CI
return
forker
.
ZEOConfig
((
'127.0.0.1'
,
0
),
client_conflict_resolution
=
True
)
class
MappingStorageTests
(
GenericTests
):
class
MappingStorageTests
(
GenericTests
):
"""ZEO backed by a Mapping storage."""
"""ZEO backed by a Mapping storage."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment