[Python-checkins] cpython (2.7): Inline the advisory text on how to use the shelve module.
raymond.hettinger
python-checkins at python.org
Fri Nov 4 21:08:01 CET 2011
http://hg.python.org/cpython/rev/e34d127f91a9
changeset: 73357:e34d127f91a9
branch: 2.7
parent: 73352:33680de042e7
user: Raymond Hettinger <python at rcn.com>
date: Fri Nov 04 13:07:52 2011 -0700
summary:
Inline the advisory text on how to use the shelve module.
files:
Doc/library/shelve.rst | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst
--- a/Doc/library/shelve.rst
+++ b/Doc/library/shelve.rst
@@ -44,17 +44,12 @@
determine which accessed entries are mutable, nor which ones were actually
mutated).
- .. note::
+ Like file objects, shelve objects should closed explicitly to assure
+ that the peristent data is flushed to disk.
- Do not rely on the shelf being closed automatically; always call
- :meth:`close` explicitly when you don't need it any more, or use a
- :keyword:`with` statement with :func:`contextlib.closing`.
-
-.. warning::
-
- Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure
- to load a shelf from an untrusted source. Like with pickle, loading a shelf
- can execute arbitrary code.
+ Since the :mod:`shelve` module stores objects using :mod:`pickle`, the same
+ security precautions apply. Accordingly, you should avoid loading a shelf
+ from an untrusted source.
Shelf objects support all methods supported by dictionaries. This eases the
transition from dictionary based scripts to those requiring persistent storage.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list