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
Kirill Smelkov
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
Show 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
# PyPy uses a python implementation of cPickle/zodbpickle in both Python 2
# and Python 3. We can't really detect inst_persistent_id as its
# and Python 3. We can't really detect inst_persistent_id as its
# a magic attribute that's not readable, but it doesn't hurt to
# a magic attribute that's not readable, but it doesn't hurt to
# simply always assign to persistent_id also
# simply always assign to persistent_id also
p
.
persistent_id
=
persistent_id
p
.
persistent_id
=
persistent_id
else
:
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,14 +114,6 @@ def PersistentUnpickler(find_global, load_persistent, *args, **kwargs):
...
@@ -114,14 +114,6 @@ def PersistentUnpickler(find_global, load_persistent, *args, **kwargs):
try
:
try
:
# Python 2.x
if
IS_JYTHON
:
# 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?
# XXX: why not just import BytesIO from io?
from
cStringIO
import
StringIO
as
BytesIO
from
cStringIO
import
StringIO
as
BytesIO
except
ImportError
:
except
ImportError
:
...
...
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