Message133385
..
> So here is the rewritten .yeah-2.diff.
..
> I added more tests (i'm absolutely convinced that the tests i've
> found in test_mailbox.py really find all the cutting edges <;).
> On my box this is clean.
Haha, now this is *very* funny!
______
Traceback (most recent call last):
...
File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/parser.py", line 104, in parse
return self.parser.parse(fp, headersonly)
File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 1900, in flush
raise io.UnsupportedOperation('flush')
Exception: io.UnsupportedOperation: flush
______
So, don't ask me why anyone tries to flush a readonly ProxyFile!
BytesParser wraps this in TextIO, and in Modules/_io/textio.c i find:
c_STRVAR(textiowrapper_doc,
"\n"
"If line_buffering is True, a call to flush is implied when a call to\n"
"write contains a newline character."
);
..
typedef struct
{
..
/* Reads and writes are internally buffered in order to speed things up.
However, any read will first flush the write buffer if itsn't empty.
..
} textio;
No reason to call flush.
So i replaced flush() and got this:
______
...
File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/parser.py", line 104, in parse
return self.parser.parse(fp, headersonly)
File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/parser.py", line 48, in parse
data = fp.read(8192)
Exception: AttributeError: '_PartialFile' object has no attribute 'read1'
______
Nice. It seems that deriving _ProxyFile from io.RawIOBase will
not work correctly with the current EMail package because
BytesParser uses TextIOWrapper expects io.BufferedIOBase.
Regardless of the fact i think TextIOWrapper should be
configurable not to close the "buffer" - s...!
Anyway, it's seems not to be practical to implement ProxyFile
*correctly*. Therefore i'll attach yeah-3.diff which falsely
ignores calls to flush().
To make this s... rock it is now also derived from
io.BufferedIOBase, thus i've reintroduced read1() which - true -
is now also tested! *YES IT CAN*!
Nice weekend. |
|
Date |
User |
Action |
Args |
2011-04-09 13:27:33 | sdaoden | set | recipients:
+ sdaoden, twouters, georg.brandl, amaury.forgeotdarc, r.david.murray |
2011-04-09 13:27:32 | sdaoden | link | issue11700 messages |
2011-04-09 13:27:31 | sdaoden | create | |
|