Commit fac0f84e authored by Tres Seaver's avatar Tres Seaver

Allow for unpickler returning 'long' from load in Python2.

Another step toward PyPy support.
parent da0f3308
...@@ -96,6 +96,9 @@ try: ...@@ -96,6 +96,9 @@ try:
except NameError: except NameError:
# Py3 # Py3
long = int long = int
INT_TYPES = (int,)
else:
INT_TYPES = (int, long)
try: try:
......
...@@ -44,7 +44,9 @@ from BTrees.fsBTree import fsBucket ...@@ -44,7 +44,9 @@ from BTrees.fsBTree import fsBucket
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
import six import six
from ZODB._compat import Pickler, Unpickler from ZODB._compat import INT_TYPES
from ZODB._compat import Pickler
from ZODB._compat import Unpickler
# convert between numbers and six-byte strings # convert between numbers and six-byte strings
...@@ -119,7 +121,7 @@ class fsIndex(object): ...@@ -119,7 +121,7 @@ class fsIndex(object):
with open(fname, 'rb') as f: with open(fname, 'rb') as f:
unpickler = Unpickler(f) unpickler = Unpickler(f)
pos = unpickler.load() pos = unpickler.load()
if not isinstance(pos, int): if not isinstance(pos, INT_TYPES):
# NB: this might contain OIDs that got unpickled # NB: this might contain OIDs that got unpickled
# into Unicode strings on Python 3; hope the caller # into Unicode strings on Python 3; hope the caller
# will pipe the result to fsIndex().update() to normalize # will pipe the result to fsIndex().update() to normalize
......
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