summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-12-05 03:58:17 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-12-05 03:58:17 (GMT)
commit1bc82f891c2ed0c4b062158d2c8339fb90406395 (patch)
treef2c67a20e814bafd37095e650157261d02e654d7 /Lib
parent7cf9ce24409efb70efde08e350a4170dc98008a1 (diff)
downloadcpython-1bc82f891c2ed0c4b062158d2c8339fb90406395.zip
cpython-1bc82f891c2ed0c4b062158d2c8339fb90406395.tar.gz
cpython-1bc82f891c2ed0c4b062158d2c8339fb90406395.tar.bz2
Removed deprecated method arguments from the shelve module.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shelve.py23
-rw-r--r--Lib/test/test_shelve.py16
2 files changed, 15 insertions, 24 deletions
diff --git a/Lib/shelve.py b/Lib/shelve.py
index 5e680bc..4959c26 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -80,14 +80,8 @@ class Shelf(UserDict.DictMixin):
See the module's __doc__ string for an overview of the interface.
"""
- def __init__(self, dict, protocol=None, writeback=False, binary=None):
+ def __init__(self, dict, protocol=None, writeback=False):
self.dict = dict
- if protocol is not None and binary is not None:
- raise ValueError, "can't specify both 'protocol' and 'binary'"
- if binary is not None:
- warnings.warn("The 'binary' argument to Shelf() is deprecated",
- PendingDeprecationWarning)
- protocol = int(binary)
if protocol is None:
protocol = 0
self._protocol = protocol
@@ -171,8 +165,8 @@ class BsdDbShelf(Shelf):
See the module's __doc__ string for an overview of the interface.
"""
- def __init__(self, dict, protocol=None, writeback=False, binary=None):
- Shelf.__init__(self, dict, protocol, writeback, binary)
+ def __init__(self, dict, protocol=None, writeback=False):
+ Shelf.__init__(self, dict, protocol, writeback)
def set_location(self, key):
(key, value) = self.dict.set_location(key)
@@ -207,12 +201,12 @@ class DbfilenameShelf(Shelf):
See the module's __doc__ string for an overview of the interface.
"""
- def __init__(self, filename, flag='c', protocol=None, writeback=False, binary=None):
+ def __init__(self, filename, flag='c', protocol=None, writeback=False):
import anydbm
- Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback, binary)
+ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
-def open(filename, flag='c', protocol=None, writeback=False, binary=None):
+def open(filename, flag='c', protocol=None, writeback=False):
"""Open a persistent dictionary for reading and writing.
The filename parameter is the base filename for the underlying
@@ -222,10 +216,7 @@ def open(filename, flag='c', protocol=None, writeback=False, binary=None):
anydbm.open(). The optional protocol parameter specifies the
version of the pickle protocol (0, 1, or 2).
- The optional binary parameter is deprecated and may be set to True
- to force the use of binary pickles for serializing data values.
-
See the module's __doc__ string for an overview of the interface.
"""
- return DbfilenameShelf(filename, flag, protocol, writeback, binary)
+ return DbfilenameShelf(filename, flag, protocol, writeback)
diff --git a/Lib/test/test_shelve.py b/Lib/test/test_shelve.py
index e3f237d..447d06d 100644
--- a/Lib/test/test_shelve.py
+++ b/Lib/test/test_shelve.py
@@ -10,7 +10,7 @@ class TestCase(unittest.TestCase):
def test_ascii_file_shelf(self):
try:
- s = shelve.open(self.fn, binary=False)
+ s = shelve.open(self.fn, protocol=0)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
s.close()
@@ -20,7 +20,7 @@ class TestCase(unittest.TestCase):
def test_binary_file_shelf(self):
try:
- s = shelve.open(self.fn, binary=True)
+ s = shelve.open(self.fn, protocol=1)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
s.close()
@@ -40,12 +40,12 @@ class TestCase(unittest.TestCase):
def test_in_memory_shelf(self):
d1 = {}
- s = shelve.Shelf(d1, binary=False)
+ s = shelve.Shelf(d1, protocol=0)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
s.close()
d2 = {}
- s = shelve.Shelf(d2, binary=True)
+ s = shelve.Shelf(d2, protocol=1)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
s.close()
@@ -102,19 +102,19 @@ class TestShelveBase(mapping_tests.BasicTestMappingProtocol):
os.unlink(f)
class TestAsciiFileShelve(TestShelveBase):
- _args={'binary':False}
+ _args={'protocol':0}
_in_mem = False
class TestBinaryFileShelve(TestShelveBase):
- _args={'binary':True}
+ _args={'protocol':1}
_in_mem = False
class TestProto2FileShelve(TestShelveBase):
_args={'protocol':2}
_in_mem = False
class TestAsciiMemShelve(TestShelveBase):
- _args={'binary':False}
+ _args={'protocol':0}
_in_mem = True
class TestBinaryMemShelve(TestShelveBase):
- _args={'binary':True}
+ _args={'protocol':1}
_in_mem = True
class TestProto2MemShelve(TestShelveBase):
_args={'protocol':2}