@@ -18,7 +18,7 @@ lots of shared sub-objects. The keys are ordinary strings.
1818
1919
2020.. function :: open(filename, flag='c', protocol=None, writeback=False, *, \
21- serializer=None, deserializer=None)
21+ mode=0o666, serializer=None, deserializer=None)
2222
2323 Open a persistent dictionary. The filename specified is the base filename for
2424 the underlying database. As a side-effect, an extension may be added to the
@@ -42,6 +42,9 @@ lots of shared sub-objects. The keys are ordinary strings.
4242 determine which accessed entries are mutable, nor which ones were actually
4343 mutated).
4444
45+ The optional *mode * parameter controls the file mode (permissions) when creating
46+ a new shelf. It has the same interpretation as the *mode * parameter of :func: `dbm.open `.
47+
4548 By default, :mod: `!shelve ` uses :func: `pickle.dumps ` and :func: `pickle.loads `
4649 for serializing and deserializing. This can be changed by supplying
4750 *serializer * and *deserializer *, respectively.
@@ -66,7 +69,8 @@ lots of shared sub-objects. The keys are ordinary strings.
6669
6770 .. versionchanged :: 3.15
6871 Accepts custom *serializer * and *deserializer * functions in place of
69- :func: `pickle.dumps ` and :func: `pickle.loads `.
72+ :func: `pickle.dumps ` and :func: `pickle.loads `. Accepts *mode * to
73+ control file mode, behavior is the same as in :func: `dbm.open `.
7074
7175 .. note ::
7276
@@ -209,19 +213,19 @@ Restrictions
209213
210214
211215.. class :: DbfilenameShelf(filename, flag='c', protocol=None, \
212- writeback=False, *, serializer=None , \
213- deserializer=None)
216+ writeback=False, *, mode=0o666 , \
217+ serializer=None, deserializer=None)
214218
215219 A subclass of :class: `Shelf ` which accepts a *filename * instead of a dict-like
216220 object. The underlying file will be opened using :func: `dbm.open `. By
217221 default, the file will be created and opened for both read and write. The
218222 optional *flag * parameter has the same interpretation as for the
219- :func: `.open ` function. The optional *protocol *, *writeback *, *serializer *
223+ :func: `.open ` function. The optional *mode *, * protocol *, *writeback *, *serializer *
220224 and *deserializer * parameters have the same interpretation as in
221225 :func: `~shelve.open `.
222226
223227 .. versionchanged :: 3.15
224- Added the *serializer * and *deserializer * parameters.
228+ Added the *mode *, * serializer * and *deserializer * parameters.
225229
226230
227231.. _shelve-example :
0 commit comments