diff options
| author | bwarsaw | 2001-07-19 03:22:10 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-07-19 03:22:10 +0000 |
| commit | 6c12249b5a9beb88a0a0edc393641fa0aaeca712 (patch) | |
| tree | 748d513413aeaf927609e32a6535e0ad09533c86 /Mailman/Queue/Switchboard.py | |
| parent | 230d9a3b72e3c8287147cf53b040e51b723d0a68 (diff) | |
| download | mailman-6c12249b5a9beb88a0a0edc393641fa0aaeca712.tar.gz mailman-6c12249b5a9beb88a0a0edc393641fa0aaeca712.tar.zst mailman-6c12249b5a9beb88a0a0edc393641fa0aaeca712.zip | |
Diffstat (limited to 'Mailman/Queue/Switchboard.py')
| -rw-r--r-- | Mailman/Queue/Switchboard.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py index 6cc877a0a..75021f3da 100644 --- a/Mailman/Queue/Switchboard.py +++ b/Mailman/Queue/Switchboard.py @@ -142,22 +142,24 @@ class _Switchboard: os.unlink(dbfile) except EnvironmentError, e: if e.errno <> errno.ENOENT: raise - # Using a pickle file will be the more common operation, so try to - # open that first, and only open the plain text file if that fails. + msgfp = None try: - msgfp = open(pckfile) - msg = cPickle.load(msgfp) - msgfp.close() - os.unlink(pckfile) - except EnvironmentError, e: - if e.errno <> errno.ENOENT: raise try: - msgfp = open(msgfile) - msg = Parser(_class=Message.Message).parse(msgfp) - msgfp.close() - os.unlink(msgfile) + msgfp = open(pckfile) + msg = cPickle.load(msgfp) + os.unlink(pckfile) except EnvironmentError, e: if e.errno <> errno.ENOENT: raise + msgfp = None + try: + msgfp = open(msgfile) + msg = Parser(_class=Message.Message).parse(msgfp) + os.unlink(msgfile) + except EnvironmentError, e: + if e.errno <> errno.ENOENT: raise + finally: + if msgfp: + msgfp.close() return msg, data def files(self): |
