[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-18 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8b38a81ba3bf by Petri Lehtinen in branch '2.7':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/8b38a81ba3bf

New changeset 38e2a87c9051 by Petri Lehtinen in branch '3.2':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/38e2a87c9051

New changeset 072b08989731 by Petri Lehtinen in branch 'default':
Fix NEWS entry for #15036
http://hg.python.org/cpython/rev/072b08989731

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-18 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Perfect, fixed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-16 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Yes, this is what I tried to say. It's hard for me to find a good
wording, so what would you suggest?

I also noticed now that there's a typo in the commit messages. But
those cannot be fixed anymore.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-16 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Mailbox no longer throws an error if a flush is done between operations when 
removing or changing multiple items in mbox, MMDF, or Babyl mailboxes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

As I suspected, all single-file mailboxes(mbox, MMDF, Babyl) have this issue. 
Attached a patch with tests.

--
keywords: +patch
Added file: http://bugs.python.org/file26017/issue15036.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 0add70dd3c43 by Petri Lehtinen in branch '2.7':
#15036: Make a repeated changes and flushes work with single-file mailboxes
http://hg.python.org/cpython/rev/0add70dd3c43

New changeset 714b8f91f3d4 by Petri Lehtinen in branch '3.2':
#15036: Make a repeated changes and flushes work with single-file mailboxes
http://hg.python.org/cpython/rev/714b8f91f3d4

New changeset 87d119117560 by Petri Lehtinen in branch 'default':
#15036: Make a repeated changes and flushes work with single-file mailboxes
http://hg.python.org/cpython/rev/87d119117560

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-15 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The news item isn't completely clear.  It sounds like the mailbox is now 
automatically being flushed between pops, but what you really fixed is popping 
if the *application* does a flush between them, right?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-14 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

The fix seems to be very simple:

diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index a677729..2be4c83 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -675,6 +675,7 @@ class _singlefileMailbox(Mailbox):
 new_file.write(buffer)
 new_toc[key] = (new_start, new_file.tell())
 self._post_message_hook(new_file)
+self._file_length = new_file.tell()
 except:
 new_file.close()
 os.remove(new_file.name)

I guess all single-file mailboxes have this issue, not only mbox. I'll still 
need to add tests when I have time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-08 Thread Petri Lehtinen

New submission from Petri Lehtinen pe...@digip.org:

test_mbox is an mbox mailbox with a few messages in it.

 import mailbox
 inbox = mailbox.mbox('test_mbox')
 inbox.lock()
 inbox.popitem()
(0, mailbox.mboxMessage instance at 0x7f78016bc680)
 inbox.flush()
 inbox.unlock()
 inbox.lock()
 inbox.popitem()
(1, mailbox.mboxMessage instance at 0x7f7801653320)
 inbox.flush()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/mailbox.py, line 633, in flush
(self._file_length, cur_len))
mailbox.ExternalClashError: Size of mailbox file changed (expected 141289, 
found 141147)

--
components: Library (Lib)
messages: 162528
nosy: petri.lehtinen
priority: normal
severity: normal
status: open
title: mailbox.mbox fails to pop two items in a row, flushing in between
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-08 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Actually, you don't even need to unlock() and lock() the mailbox  before the 
second popitem() and flush().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15036] mailbox.mbox fails to pop two items in a row, flushing in between

2012-06-08 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
components: +email
nosy: +barry, r.david.murray
stage:  - needs patch
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15036
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com