Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
7372b310
Commit
7372b310
authored
May 20, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanups in _compat.
parent
0012ca0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
src/ZODB/_compat.py
src/ZODB/_compat.py
+10
-18
No files found.
src/ZODB/_compat.py
View file @
7372b310
...
@@ -18,7 +18,8 @@ IS_JYTHON = sys.platform.startswith('java')
...
@@ -18,7 +18,8 @@ IS_JYTHON = sys.platform.startswith('java')
try
:
try
:
# Python 2.x
# Python 2.x
import
cPickle
import
cPickle
if
(
hasattr
(
cPickle
.
Unpickler
,
'load'
)
and
not
hasattr
(
cPickle
.
Unpickler
,
'noload'
))
or
sys
.
version_info
>=
(
2
,
7
):
if
((
hasattr
(
cPickle
.
Unpickler
,
'load'
)
and
not
hasattr
(
cPickle
.
Unpickler
,
'noload'
))
or
sys
.
version_info
>=
(
2
,
7
)):
# PyPy doesn't have noload, and noload is broken in Python 2.7.
# PyPy doesn't have noload, and noload is broken in Python 2.7.
# Get the fastest version we can (PyPy has no fastpickle)
# Get the fastest version we can (PyPy has no fastpickle)
try
:
try
:
...
@@ -83,13 +84,12 @@ def PersistentPickler(persistent_id, *args, **kwargs):
...
@@ -83,13 +84,12 @@ def PersistentPickler(persistent_id, *args, **kwargs):
p
=
Pickler
(
*
args
,
**
kwargs
)
p
=
Pickler
(
*
args
,
**
kwargs
)
if
sys
.
version_info
[
0
]
<
3
:
if
sys
.
version_info
[
0
]
<
3
:
p
.
inst_persistent_id
=
persistent_id
p
.
inst_persistent_id
=
persistent_id
# PyPy uses a python implementation of cPickle in both Python 2
# and Python 3. We can't really detect inst_persistent_id as its
# PyPy uses a python implementation of cPickle/zodbpickle in both Python 2
# a magic attribute that's not readable, but it doesn't hurt to
# and Python 3. We can't really detect inst_persistent_id as its
# simply always assign to persistent_id also
# a magic attribute that's not readable, but it doesn't hurt to
p
.
persistent_id
=
persistent_id
# simply always assign to persistent_id also
else
:
p
.
persistent_id
=
persistent_id
p
.
persistent_id
=
persistent_id
return
p
return
p
def
PersistentUnpickler
(
find_global
,
load_persistent
,
*
args
,
**
kwargs
):
def
PersistentUnpickler
(
find_global
,
load_persistent
,
*
args
,
**
kwargs
):
...
@@ -114,16 +114,8 @@ def PersistentUnpickler(find_global, load_persistent, *args, **kwargs):
...
@@ -114,16 +114,8 @@ def PersistentUnpickler(find_global, load_persistent, *args, **kwargs):
try
:
try
:
# Python 2.x
# XXX: why not just import BytesIO from io?
if
IS_JYTHON
:
from
cStringIO
import
StringIO
as
BytesIO
# Jython 2.7rc2 cStringIO.StringIO class has a bug
# resulting in StringIndexOutOfBoundExceptions
# when repeatedly writing and then seeking back to 0
# http://bugs.jython.org/issue2324
from
io
import
BytesIO
else
:
# XXX: why not just import BytesIO from io?
from
cStringIO
import
StringIO
as
BytesIO
except
ImportError
:
except
ImportError
:
# Python 3.x
# Python 3.x
from
io
import
BytesIO
from
io
import
BytesIO
...
...
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