diff options
author | Raymond Hettinger <python@rcn.com> | 2011-11-04 20:07:52 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-11-04 20:07:52 (GMT) |
commit | 23ca12a981bd51047d14f7579b2eb613e667e33a (patch) | |
tree | 22f6ecdbf065403e2f1e1af2a043795443ff850b | |
parent | ce7554f0a1159e5c473be34090ee85675f4835a4 (diff) | |
download | cpython-23ca12a981bd51047d14f7579b2eb613e667e33a.zip cpython-23ca12a981bd51047d14f7579b2eb613e667e33a.tar.gz cpython-23ca12a981bd51047d14f7579b2eb613e667e33a.tar.bz2 |
Inline the advisory text on how to use the shelve module.
-rw-r--r-- | Doc/library/shelve.rst | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst index 7a70ff4..cc2c1f0 100644 --- a/Doc/library/shelve.rst +++ b/Doc/library/shelve.rst @@ -44,17 +44,12 @@ lots of shared sub-objects. The keys are ordinary strings. 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. |