A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-July/036851.html below:

[Python-Dev] improving dumbdbm's survival chances...

[Python-Dev] improving dumbdbm's survival chances...Skip Montanaro skip@pobox.com
Sun, 13 Jul 2003 13:32:15 -0500
(CC'ing python-dev because I think there's a simple improvement/fix for
dumbdbm here.)

I realize we (the Spambayes folks) want to discourage people from using
dumbdbm, but for those who are either stuck with it or don't realize they
are using it, I wonder if we can do a little something to help them out.

As I understand it, if a machine crashes or is shut down without exiting
Outlook, there's a good chance that the dumbdbm's _commit method won't have
been called and the directory and data files will be out-of-sync.  It seems
that dumbdbm doesn't support a sync() method which shelve likes to call.
Shelve's sync method gets called from time-to-time by the Spambayes storage
code.  dumbdbm.sync has this statement:

    if hasattr(self.dict, 'sync'):
        self.dict.sync()

so maybe it's as simple (short-term) as modifying dbmstorage.open_dumbdbm()
to

    def open_dumbdbm(*args):
        """Open a dumbdbm database."""
        import dumbdbm
        db = dumbdbm.open(*args)
        if not hasattr(db, "sync"):
            db.sync = db._commit
        return db

The above should help.  Meanwhile, it appears that would be a good method to
add to dumbdbm databases both for 2.3 and the 2.2 maintenance branch.

Skip



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4