forked from Lainports/freebsd-ports
databases/py-zodbpickle: Update to 2.4
Changes: https://github.com/zopefoundation/zodbpickle/blob/master/CHANGES.rst
This commit is contained in:
parent
eec9ce4838
commit
469830872f
3 changed files with 7 additions and 259 deletions
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= zodbpickle
|
||||
PORTVERSION= 2.3
|
||||
PORTVERSION= 2.4
|
||||
CATEGORIES= databases python
|
||||
MASTER_SITES= CHEESESHOP
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1655208248
|
||||
SHA256 (zodbpickle-2.3.tar.gz) = e4cb5c719705e8bb1e8eee4aa24e2071a3094ecf2783d87407ab822f166da3a2
|
||||
SIZE (zodbpickle-2.3.tar.gz) = 184969
|
||||
TIMESTAMP = 1663672802
|
||||
SHA256 (zodbpickle-2.4.tar.gz) = bd6cc920f2833ba6d35b3bf1c3269e9210ebfc01ecd7f1768c22f63aaa0753ad
|
||||
SIZE (zodbpickle-2.4.tar.gz) = 185991
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
--- src/zodbpickle/pickle_2.py.orig 2021-09-29 06:13:32 UTC
|
||||
--- src/zodbpickle/pickle_2.py.orig 2022-09-15 06:24:37 UTC
|
||||
+++ src/zodbpickle/pickle_2.py
|
||||
@@ -27,8 +27,8 @@ Misc variables:
|
||||
__version__ = "$Revision: 72223 $" # Code version
|
||||
|
|
@ -232,64 +232,7 @@
|
|||
|
||||
def dump(obj, file, protocol=None):
|
||||
Pickler(file, protocol).dump(obj)
|
||||
--- src/zodbpickle/pickle_3.py.orig 2021-09-29 06:13:32 UTC
|
||||
+++ src/zodbpickle/pickle_3.py
|
||||
@@ -601,7 +601,7 @@ class _Pickler:
|
||||
return
|
||||
|
||||
items = iter(items)
|
||||
- r = range(self._BATCHSIZE)
|
||||
+ r = list(range(self._BATCHSIZE))
|
||||
while items is not None:
|
||||
tmp = []
|
||||
for i in r:
|
||||
@@ -631,7 +631,7 @@ class _Pickler:
|
||||
write(MARK + DICT)
|
||||
|
||||
self.memoize(obj)
|
||||
- self._batch_setitems(obj.items())
|
||||
+ self._batch_setitems(list(obj.items()))
|
||||
|
||||
dispatch[dict] = save_dict
|
||||
if PyStringMap is not None:
|
||||
@@ -650,7 +650,7 @@ class _Pickler:
|
||||
return
|
||||
|
||||
items = iter(items)
|
||||
- r = range(self._BATCHSIZE)
|
||||
+ r = list(range(self._BATCHSIZE))
|
||||
while items is not None:
|
||||
tmp = []
|
||||
for i in r:
|
||||
@@ -1182,8 +1182,8 @@ class _Unpickler:
|
||||
try:
|
||||
value = func(*args)
|
||||
except:
|
||||
- print(sys.exc_info())
|
||||
- print(func, args)
|
||||
+ print((sys.exc_info()))
|
||||
+ print((func, args))
|
||||
raise
|
||||
stack[-1] = value
|
||||
dispatch[REDUCE[0]] = load_reduce
|
||||
@@ -1290,13 +1290,13 @@ class _Unpickler:
|
||||
if state:
|
||||
inst_dict = inst.__dict__
|
||||
intern = sys.intern
|
||||
- for k, v in state.items():
|
||||
+ for k, v in list(state.items()):
|
||||
if type(k) is str:
|
||||
- inst_dict[intern(k)] = v
|
||||
+ inst_dict[sys.intern(k)] = v
|
||||
else:
|
||||
inst_dict[k] = v
|
||||
if slotstate:
|
||||
- for k, v in slotstate.items():
|
||||
+ for k, v in list(slotstate.items()):
|
||||
setattr(inst, k, v)
|
||||
dispatch[BUILD[0]] = load_build
|
||||
|
||||
--- src/zodbpickle/pickletools_2.py.orig 2021-09-29 06:13:32 UTC
|
||||
--- src/zodbpickle/pickletools_2.py.orig 2022-09-15 06:24:37 UTC
|
||||
+++ src/zodbpickle/pickletools_2.py
|
||||
@@ -429,7 +429,7 @@ def read_unicodestringnl(f):
|
||||
raise ValueError("no newline found when trying to read "
|
||||
|
|
@ -420,7 +363,7 @@
|
|||
if stack:
|
||||
raise ValueError("stack not empty after STOP: %r" % stack)
|
||||
|
||||
--- src/zodbpickle/tests/pickletester_2.py.orig 2021-09-29 06:13:32 UTC
|
||||
--- src/zodbpickle/tests/pickletester_2.py.orig 2022-09-15 06:24:37 UTC
|
||||
+++ src/zodbpickle/tests/pickletester_2.py
|
||||
@@ -1,8 +1,8 @@
|
||||
import io
|
||||
|
|
@ -832,198 +775,3 @@
|
|||
f.write(pickled1)
|
||||
f.seek(0)
|
||||
unpickler = self.unpickler_class(f)
|
||||
--- src/zodbpickle/tests/pickletester_3.py.orig 2021-09-29 06:13:32 UTC
|
||||
+++ src/zodbpickle/tests/pickletester_3.py
|
||||
@@ -39,7 +39,7 @@ from . import _is_pypy
|
||||
# Tests that try a number of pickle protocols should have a
|
||||
# for proto in protocols:
|
||||
# kind of outer loop.
|
||||
-protocols = range(pickle.HIGHEST_PROTOCOL + 1)
|
||||
+protocols = list(range(pickle.HIGHEST_PROTOCOL + 1))
|
||||
|
||||
ascii_char_size = 1
|
||||
|
||||
@@ -650,10 +650,10 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
self.assertRaises(ValueError, self.loads, buf)
|
||||
|
||||
def test_unicode(self):
|
||||
- endcases = ['', '<\\u>', '<\\\u1234>', '<\n>',
|
||||
- '<\\>', '<\\\U00012345>',
|
||||
+ endcases = ['', '<\\u>', '<\\\\u1234>', '<\n>',
|
||||
+ '<\\>', '<\\\\U00012345>',
|
||||
# surrogates
|
||||
- '<\udc80>']
|
||||
+ '<\\udc80>']
|
||||
for proto in protocols:
|
||||
for u in endcases:
|
||||
p = self.dumps(u, proto)
|
||||
@@ -661,7 +661,7 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
self.assertEqual(u2, u)
|
||||
|
||||
def test_unicode_high_plane(self):
|
||||
- t = '\U00012345'
|
||||
+ t = '\\U00012345'
|
||||
for proto in protocols:
|
||||
p = self.dumps(t, proto)
|
||||
t2 = self.loads(p)
|
||||
@@ -1017,7 +1017,7 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
|
||||
def test_dict_chunking(self):
|
||||
n = 10 # too small to chunk
|
||||
- x = dict.fromkeys(range(n))
|
||||
+ x = dict.fromkeys(list(range(n)))
|
||||
for proto in protocols:
|
||||
s = self.dumps(x, proto)
|
||||
self.assertIsInstance(s, bytes_types)
|
||||
@@ -1027,7 +1027,7 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
self.assertEqual(num_setitems, proto > 0)
|
||||
|
||||
n = 2500 # expect at least two chunks when proto > 0
|
||||
- x = dict.fromkeys(range(n))
|
||||
+ x = dict.fromkeys(list(range(n)))
|
||||
for proto in protocols:
|
||||
s = self.dumps(x, proto)
|
||||
y = self.loads(s)
|
||||
@@ -1170,7 +1170,7 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
loaded = self.loads(DATA3)
|
||||
self.assertEqual(loaded, set([1, 2]))
|
||||
loaded = self.loads(DATA4)
|
||||
- self.assertEqual(type(loaded), type(range(0)))
|
||||
+ self.assertEqual(type(loaded), type(list(range(0))))
|
||||
self.assertEqual(list(loaded), list(range(5)))
|
||||
loaded = self.loads(DATA5)
|
||||
self.assertEqual(type(loaded), SimpleCookie)
|
||||
@@ -1189,7 +1189,7 @@ class AbstractPickleTests(unittest.TestCase):
|
||||
# the same result as Python 2.x did.
|
||||
# NOTE: this test is a bit too strong since we can produce different
|
||||
# bytecode that 2.x will still understand.
|
||||
- dumped = self.dumps(range(5), 2)
|
||||
+ dumped = self.dumps(list(range(5)), 2)
|
||||
self.assertEqual(dumped, DATA4)
|
||||
|
||||
dumped = self.dumps(set([3]), 2)
|
||||
@@ -1328,24 +1328,24 @@ class AbstractBytestrTests(unittest.TestCase):
|
||||
|
||||
def test_load_unicode_protocol_0(self):
|
||||
""" Test unicode with protocol=0
|
||||
- python 2: pickle.dumps(u"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440", protocol=0) """
|
||||
+ python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=0) """
|
||||
self.unpickleEqual(
|
||||
b'V\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440\np0\n.',
|
||||
- '\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440')
|
||||
+ '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440')
|
||||
|
||||
def test_load_unicode_protocol_1(self):
|
||||
""" Test unicode with protocol=1
|
||||
- python 2: pickle.dumps(u"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440", protocol=1) """
|
||||
+ python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=1) """
|
||||
self.unpickleEqual(
|
||||
b'X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.',
|
||||
- '\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440')
|
||||
+ '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440')
|
||||
|
||||
def test_load_unicode_protocol_2(self):
|
||||
""" Test unicode with protocol=1
|
||||
- python 2: pickle.dumps(u"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440", protocol=2) """
|
||||
+ python 2: pickle.dumps(u"\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440", protocol=2) """
|
||||
self.unpickleEqual(
|
||||
b'\x80\x02X\x12\x00\x00\x00\xd0\x9a\xd0\xbe\xd0\xbc\xd0\xbf\xd1\x8c\xd1\x8e\xd1\x82\xd0\xb5\xd1\x80q\x00.',
|
||||
- '\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440')
|
||||
+ '\\u041a\\u043e\\u043c\\u043f\\u044c\\u044e\\u0442\\u0435\\u0440')
|
||||
|
||||
def test_load_long_str_protocol_1(self):
|
||||
""" Test long str with protocol=1
|
||||
@@ -1511,7 +1511,7 @@ class REX_seven(object):
|
||||
def __setitem__(self, key, value):
|
||||
self.table[key] = value
|
||||
def __reduce__(self):
|
||||
- return type(self), (), None, None, iter(self.table.items())
|
||||
+ return type(self), (), None, None, iter(list(self.table.items()))
|
||||
|
||||
|
||||
# Test classes for newobj
|
||||
@@ -1529,7 +1529,7 @@ class MyStr(str):
|
||||
sample = "hello"
|
||||
|
||||
class MyUnicode(str):
|
||||
- sample = "hello \u1234"
|
||||
+ sample = "hello \\u1234"
|
||||
|
||||
class MyTuple(tuple):
|
||||
sample = (1, 2, 3)
|
||||
@@ -2028,14 +2028,14 @@ if __name__ == "__main__":
|
||||
x = create_data()
|
||||
for i in range(3):
|
||||
p = pickle.dumps(x, i)
|
||||
- print("DATA{0} = (".format(i))
|
||||
+ print(("DATA{0} = (".format(i)))
|
||||
for j in range(0, len(p), 20):
|
||||
b = bytes(p[j:j+20])
|
||||
- print(" {0!r}".format(b))
|
||||
+ print((" {0!r}".format(b)))
|
||||
print(")")
|
||||
print()
|
||||
- print("# Disassembly of DATA{0}".format(i))
|
||||
- print("DATA{0}_DIS = \"\"\"\\".format(i))
|
||||
+ print(("# Disassembly of DATA{0}".format(i)))
|
||||
+ print(("DATA{0}_DIS = \"\"\"\\".format(i)))
|
||||
dis(p)
|
||||
print("\"\"\"")
|
||||
print()
|
||||
--- src/zodbpickle/tests/test_pickle_2.py.orig 2021-09-29 06:13:32 UTC
|
||||
+++ src/zodbpickle/tests/test_pickle_2.py
|
||||
@@ -1,7 +1,7 @@
|
||||
-import cStringIO
|
||||
import io
|
||||
+import io
|
||||
import unittest
|
||||
-from cStringIO import StringIO
|
||||
+from io import StringIO
|
||||
|
||||
from .pickletester_2 import (AbstractPickleTests,
|
||||
AbstractPickleModuleTests,
|
||||
@@ -13,7 +13,7 @@ from .pickletester_2 import (AbstractPickleTests,
|
||||
from test import test_support
|
||||
|
||||
class cStringIOMixin:
|
||||
- output = input = cStringIO.StringIO
|
||||
+ output = input = io.StringIO
|
||||
|
||||
def close(self, f):
|
||||
pass
|
||||
@@ -70,7 +70,7 @@ class PicklerTests(AbstractPickleTests):
|
||||
|
||||
def dumps(self, arg, proto=0, fast=0):
|
||||
from zodbpickle.pickle_2 import Pickler
|
||||
- f = cStringIO.StringIO()
|
||||
+ f = io.StringIO()
|
||||
p = Pickler(f, proto)
|
||||
if fast:
|
||||
p.fast = fast
|
||||
@@ -80,7 +80,7 @@ class PicklerTests(AbstractPickleTests):
|
||||
|
||||
def loads(self, buf):
|
||||
from zodbpickle.pickle_2 import Unpickler
|
||||
- f = cStringIO.StringIO(buf)
|
||||
+ f = io.StringIO(buf)
|
||||
u = Unpickler(f)
|
||||
return u.load()
|
||||
|
||||
@@ -92,7 +92,7 @@ class PersPicklerTests(AbstractPersistentPicklerTests)
|
||||
class PersPickler(Pickler):
|
||||
def persistent_id(subself, obj):
|
||||
return self.persistent_id(obj)
|
||||
- f = cStringIO.StringIO()
|
||||
+ f = io.StringIO()
|
||||
p = PersPickler(f, proto)
|
||||
if fast:
|
||||
p.fast = fast
|
||||
@@ -105,7 +105,7 @@ class PersPicklerTests(AbstractPersistentPicklerTests)
|
||||
class PersUnpickler(Unpickler):
|
||||
def persistent_load(subself, obj):
|
||||
return self.persistent_load(obj)
|
||||
- f = cStringIO.StringIO(buf)
|
||||
+ f = io.StringIO(buf)
|
||||
u = PersUnpickler(f)
|
||||
return u.load()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue