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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
83a2c0bb
Commit
83a2c0bb
authored
Mar 28, 2018
by
Jason Madden
Committed by
GitHub
Mar 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #114 from zopefoundation/use-protocol-3
Use pickle protocol 3 on the wire.
parents
b823ccde
1b21b3a8
Changes
5
Show 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 @
83a2c0bb
Changelog
=========
5.
1.3
(unreleased)
5.
2.0
(unreleased)
------------------
- Fix ``ZEO.server`` relying on test dependencies. See `issue 105
...
...
@@ -20,6 +20,10 @@ Changelog
had ``zodbpickle.binary`` OIDs. See `issue 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)
------------------
...
...
src/ZEO/_compat.py
View file @
83a2c0bb
...
...
@@ -22,7 +22,7 @@ PYPY = getattr(platform, 'python_implementation', lambda: None)() == 'PyPy'
WIN
=
sys
.
platform
.
startswith
(
'win'
)
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
):
# Py3: Python 3 doesn't allow assignments to find_global,
# instead, find_class can be overridden
...
...
@@ -34,8 +34,15 @@ if PY3:
return
super
(
Unpickler
,
self
).
find_class
(
modulename
,
name
)
return
self
.
find_global
(
modulename
,
name
)
else
:
# Pickle support
from
cPickle
import
Pickler
,
Unpickler
,
dump
,
dumps
,
loads
try
:
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
from
ZODB._compat
import
BytesIO
...
...
src/ZEO/asyncio/marshal.py
View file @
83a2c0bb
...
...
@@ -42,12 +42,11 @@ def encoder(protocol, server=False):
else
:
assert
protocol
[:
1
]
==
b'Z'
if
PY3
or
PYPY
:
f
=
BytesIO
()
getvalue
=
f
.
getvalue
seek
=
f
.
seek
truncate
=
f
.
truncate
pickler
=
Pickler
(
f
,
3
if
PY3
else
1
)
pickler
=
Pickler
(
f
,
3
)
pickler
.
fast
=
1
dump
=
pickler
.
dump
def
encode
(
*
args
):
...
...
@@ -55,12 +54,6 @@ def encoder(protocol, server=False):
truncate
()
dump
(
args
)
return
getvalue
()
else
:
pickler
=
Pickler
(
1
)
pickler
.
fast
=
1
dump
=
pickler
.
dump
def
encode
(
*
args
):
return
dump
(
args
,
2
)
return
encode
...
...
src/ZEO/tests/ZEO4/zrpc/marshal.py
View file @
83a2c0bb
...
...
@@ -32,7 +32,6 @@ def encode(*args): # args: (msgid, flags, name, args)
# being represented by \xij escapes in proto 0).
# Undocumented: cPickle.Pickler accepts a lone protocol argument;
# pickle.py does not.
if
PY3
:
# XXX: Py3: Needs optimization.
f
=
BytesIO
()
pickler
=
Pickler
(
f
,
3
)
...
...
@@ -40,16 +39,6 @@ def encode(*args): # args: (msgid, flags, name, args)
pickler
.
dump
(
args
)
res
=
f
.
getvalue
()
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 @
83a2c0bb
...
...
@@ -487,7 +487,9 @@ class ClientConflictResolutionTests(
return
'<mappingstorage>
\
n
</mappingstorage>
\
n
'
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
):
"""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