On Fri, Jun 6, 2008 at 3:02 AM, Humberto Diogenes <[EMAIL PROTECTED]> wrote: > > I found this on Lib/email/parser.py, on Parser.parse(): > > while True: > data = fp.read(8192) > if not data: > break > # XXX When Guido fixes TextIOWrapper.read() to act just like > # .readlines(), this... > feedparser.feed(str(data)) > # ...gets reverted back to > #feedparser.feed(data) > return feedparser.close() > > Is that still necessary?
I can't tell for sure what Barry meant, but this was introduced in August 2007. Since then, a lot has changed in io.py. Why don't you try taking it out? > I noticed it while trying to migrate http.client.HTTPMessage away from > mimetools (issue 2848). I was having problems when parse() received bytes > directly, as they were being converted to 'b"..."' strings. > > BTW, is TextIOWrapper+BufferedReader the right solution to read a string > from a socket? > > # In HTTPResponse: > - self.msg = HTTPMessage(self.fp, 0) > + parser = email.parser.HeaderParser(_class=HTTPMessage) > + fp = io.TextIOWrapper(io.BufferedReader(self.fp), 'latin1') > + self.msg = parser.parse(fp) Probably. This is what the socket class's own makefile() method does. Read all about it in socket.py. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com