mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-34204: Use pickle.DEFAULT_PROTOCOL in shelve (GH-19639)
Use pickle.DEFAULT_PROTOCOL (currently 5) in shelve instead of a hardcoded 3.
This commit is contained in:
parent
4173320920
commit
df59273c7a
5 changed files with 29 additions and 8 deletions
|
@ -56,7 +56,7 @@ entries in the cache, and empty the cache (d.sync() also synchronizes
|
|||
the persistent dictionary on disk, if feasible).
|
||||
"""
|
||||
|
||||
from pickle import Pickler, Unpickler
|
||||
from pickle import DEFAULT_PROTOCOL, Pickler, Unpickler
|
||||
from io import BytesIO
|
||||
|
||||
import collections.abc
|
||||
|
@ -85,7 +85,7 @@ class Shelf(collections.abc.MutableMapping):
|
|||
keyencoding="utf-8"):
|
||||
self.dict = dict
|
||||
if protocol is None:
|
||||
protocol = 3
|
||||
protocol = DEFAULT_PROTOCOL
|
||||
self._protocol = protocol
|
||||
self.writeback = writeback
|
||||
self.cache = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue