This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bug somewhere in email Parser or PortableUnixMailbox
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: jlgijsbers, skip.montanaro
Priority: normal Keywords:

Created on 2004-07-23 05:53 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg21762 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-07-23 05:53
When run under Python 2.3 and fed a unix mbox file
on stdin, this script prints the lengths of the messages
in the file and their subjects on stdout:

import sys
import mailbox
import email.Parser

for msg in mailbox.PortableUnixMailbox(sys.stdin, 
email.Parser.Parser().parse):
    print len(str(msg)), msg["subject"]

If run using Python from CVS it prints out "38" as the
length of each message and "None" as the subject.
Something clearly changed between 2.3 and 2.4.
I've not had a chance to dig into the problem yet.
Am I using PortableUnixMailbox or email.Parser.Parser
in some unsupported and now broken way?

Assigning to Barry since he's the obvious email guru,
but anyone can feel free to jump in here.  This would
seem to be a fairly serious bug.

Skip
msg21763 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-07-23 14:22
Logged In: YES 
user_id=44345

Further investigation shows this simpler script demonstrates
the problem:

import sys
import mailbox

for msg in mailbox.PortableUnixMailbox(sys.stdin):
    print len(str(msg))

Looking at mailbox.py it appears v 1.42 is the culprit. 
Reverting to 1.41
solves the problem.  Reassigning to Andrew since he checked
in that
version.

Skip
msg21764 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-07-23 19:20
Logged In: YES 
user_id=469548

That was my patch, and it was my fault. I forgot to stick
the return calls in the read() and readline() functions. A
patch is unnecessary, I presume? 

This must be my dumbest mistake yet. 
msg21765 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-07-24 19:57
Logged In: YES 
user_id=44345

Perhaps it's your dumbest mistake yet, but I'm sure I've made dumber. 
;-)

Checked in mailbox.py as v1.43. Also added simple test case to 
test_mailbox.py v1.10.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40629
2004-07-23 05:53:40skip.montanarocreate