Bug #80
improper use of assert statement
| Status : | New | Start : | 06/18/2008 | |
| Priority : | High | Due date : | ||
| Assigned to : | - | % Done : | 0% |
|
| Category : | - | |||
| Target version : | - | |||
| Resolution : |
Description
OfflineIMAP executes a regular operation as part of an assert expression. If PYTHONOPTIMIZE is set, Python skips assert statements, thus OfflineIMAP doesn't execute the regular operation. This has given me quite a headache: deleted messages reappeared on second sync since deletion.
The one location I've found is in offlineimap.folder.IMAP.IMAPFolder.deletemessages_noconvert():
if self.expunge:
assert(imapobj.expunge()[0] == 'OK')
Other parts of the code might have the same problem. I've verified this bug is still present in the latest release.
From the Python documentation:
Assert statements are a convenient way to insert debugging assertions
into a program:
/>
The simple form, "assert expression", is equivalent to
/>
The current code generator emits no code for an assert statement when
optimization is requested at compile time.
if debug:
if not expression: raise AssertionError