summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-02-05 20:47:31 (GMT)
committerGitHub <noreply@github.com>2018-02-05 20:47:31 (GMT)
commit6c85efa5a66d7b254aa22a39d47f36c040d7a04e (patch)
tree9f9c5f626364ac0b1a768a27a694c4ae0b4e6e6b /Doc
parentc309bcfb9fb295e70a235c461d9edcaa54c821d0 (diff)
downloadcpython-6c85efa5a66d7b254aa22a39d47f36c040d7a04e.zip
cpython-6c85efa5a66d7b254aa22a39d47f36c040d7a04e.tar.gz
cpython-6c85efa5a66d7b254aa22a39d47f36c040d7a04e.tar.bz2
bpo-32749: Make dbm.dumb databases more cosistent with other dbm databases. (#5497)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/dbm.rst27
-rw-r--r--Doc/whatsnew/3.8.rst5
2 files changed, 26 insertions, 6 deletions
diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst
index 32e80b2..1abc36c 100644
--- a/Doc/library/dbm.rst
+++ b/Doc/library/dbm.rst
@@ -339,9 +339,23 @@ The module defines the following:
dumbdbm database is created, files with :file:`.dat` and :file:`.dir` extensions
are created.
- The optional *flag* argument supports only the semantics of ``'c'``
- and ``'n'`` values. Other values will default to database being always
- opened for update, and will be created if it does not exist.
+ The optional *flag* argument can be:
+
+ +---------+-------------------------------------------+
+ | Value | Meaning |
+ +=========+===========================================+
+ | ``'r'`` | Open existing database for reading only |
+ | | (default) |
+ +---------+-------------------------------------------+
+ | ``'w'`` | Open existing database for reading and |
+ | | writing |
+ +---------+-------------------------------------------+
+ | ``'c'`` | Open database for reading and writing, |
+ | | creating it if it doesn't exist |
+ +---------+-------------------------------------------+
+ | ``'n'`` | Always create a new, empty database, open |
+ | | for reading and writing |
+ +---------+-------------------------------------------+
The optional *mode* argument is the Unix mode of the file, used only when the
database has to be created. It defaults to octal ``0o666`` (and will be modified
@@ -351,9 +365,10 @@ The module defines the following:
:func:`.open` always creates a new database when the flag has the value
``'n'``.
- .. deprecated-removed:: 3.6 3.8
- Creating database in ``'r'`` and ``'w'`` modes. Modifying database in
- ``'r'`` mode.
+ .. versionchanged:: 3.8
+ A database opened with flags ``'r'`` is now read-only. Opening with
+ flags ``'r'`` and ``'w'`` no longer creates a database if it does not
+ exist.
In addition to the methods provided by the
:class:`collections.abc.MutableMapping` class, :class:`dumbdbm` objects
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index c4063ad..60f54a0 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -130,3 +130,8 @@ Changes in the Python API
arguments for changing the selection was deprecated in Python 3.6. Use
specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for
changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)
+
+* A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only.
+ :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates
+ a database if it does not exist.
+ (Contributed by Serhiy Storchaka in :issue:`32749`.)