summaryrefslogtreecommitdiffstats
path: root/Lib/shelve.py
diff options
context:
space:
mode:
authorRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>1997-03-25 16:06:03 (GMT)
committerRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>1997-03-25 16:06:03 (GMT)
commit4fc706705521cd8fed60a0403c903a377516ea95 (patch)
tree9745ba12f1ab4dc28f53f9ad800b536673484646 /Lib/shelve.py
parente8e87999ab6ed6aa5aac921fc2e262de618829d9 (diff)
downloadcpython-4fc706705521cd8fed60a0403c903a377516ea95.zip
cpython-4fc706705521cd8fed60a0403c903a377516ea95.tar.gz
cpython-4fc706705521cd8fed60a0403c903a377516ea95.tar.bz2
Added a 'sync' method to shelve. If the underlying database does not have a sync
attribute, this method silently ignores this fact. The default (bsddb's dbhash) does.
Diffstat (limited to 'Lib/shelve.py')
-rw-r--r--Lib/shelve.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/shelve.py b/Lib/shelve.py
index b05c627..8f709a2 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -72,6 +72,10 @@ class Shelf:
def __del__(self):
self.close()
+ def sync(self):
+ if hasattr(self.dict, 'sync'):
+ self.dict.sync()
+
class BsdDbShelf(Shelf):
"""Shelf implementation using the "BSD" db interface.