mirror of https://github.com/python/cpython
Change Pickler._batch_appends() and Pickler._batch_setitems() to take
an iterable object, instead of an iterator.
This commit is contained in:
parent
46c6f94c44
commit
c7db1d6888
|
@ -594,7 +594,7 @@ class Pickler:
|
||||||
write(MARK + LIST)
|
write(MARK + LIST)
|
||||||
|
|
||||||
self.memoize(obj)
|
self.memoize(obj)
|
||||||
self._batch_appends(iter(obj))
|
self._batch_appends(obj)
|
||||||
|
|
||||||
dispatch[list] = save_list
|
dispatch[list] = save_list
|
||||||
|
|
||||||
|
@ -611,6 +611,7 @@ class Pickler:
|
||||||
write(APPEND)
|
write(APPEND)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
items = iter(items)
|
||||||
r = range(self._BATCHSIZE)
|
r = range(self._BATCHSIZE)
|
||||||
while items is not None:
|
while items is not None:
|
||||||
tmp = []
|
tmp = []
|
||||||
|
@ -641,7 +642,7 @@ class Pickler:
|
||||||
write(MARK + DICT)
|
write(MARK + DICT)
|
||||||
|
|
||||||
self.memoize(obj)
|
self.memoize(obj)
|
||||||
self._batch_setitems(iter(obj.items()))
|
self._batch_setitems(obj.items())
|
||||||
|
|
||||||
dispatch[dict] = save_dict
|
dispatch[dict] = save_dict
|
||||||
if PyStringMap is not None:
|
if PyStringMap is not None:
|
||||||
|
@ -659,6 +660,7 @@ class Pickler:
|
||||||
write(SETITEM)
|
write(SETITEM)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
items = iter(items)
|
||||||
r = range(self._BATCHSIZE)
|
r = range(self._BATCHSIZE)
|
||||||
while items is not None:
|
while items is not None:
|
||||||
tmp = []
|
tmp = []
|
||||||
|
|
Loading…
Reference in New Issue