homepage

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.

Author eli.bendersky
Recipients Arfrever, eli.bendersky, philthompson10
Date 2012年03月11日.04:13:27
SpamBayes Score 4.3188473e-05
Marked as misclassified No
Message-id <1331439208.63.0.609063470616.issue14246@psf.upfronthosting.co.za>
In-reply-to
Content
Both the Python ET and _elementtree use expat, but reach its parsing function in a different path when given a file-like object (StringIO, BytesIO).
Python ET reads the stream itself and passes the data to pyexpat's Parse method, which uses PyArg_ParseTuple to decode it. The latter turns a string into bytes when required, so the parsing of str streams is handled transparently.
For _elementtree, on the other hand, ET directly calls the internal XMLParser._parse, which uses its own (C) loop to read from the stream. When it sees that it hasn't read bytes (but a string) it stops and falls back on parsing an empty document.
The fix will have to be in the latter loop, probably just converting the read string to bytes before moving on.
History
Date User Action Args
2012年03月11日 04:13:28eli.benderskysetrecipients: + eli.bendersky, philthompson10, Arfrever
2012年03月11日 04:13:28eli.benderskysetmessageid: <1331439208.63.0.609063470616.issue14246@psf.upfronthosting.co.za>
2012年03月11日 04:13:28eli.benderskylinkissue14246 messages
2012年03月11日 04:13:27eli.benderskycreate

AltStyle によって変換されたページ (->オリジナル) /