From: <bc...@wo...> - 2001-11-09 16:22:03
|
[dman] >Could someone please explain to me, again, why jython munges streams >after the fashion of ms windows if binary mode isn't specified? First, was the problem the CR-NL munging or the non-ascii munging <wink>? I assume you are running unix so it must have been be the non-ascii munging that bit you. The basic issue is how to deal with characters (16-bits) vs. bytes (8-bit). Java have two ways: Stream and Reader, but python only have one open() method. I decided to override the 'b' flag for this behavior because many (windows) programmers would already know about the 'b' flag on the open() function. By re-using the 'b' flag the default text mode was obvious because that is what windows uses. >I just had a real (annoying) waste of time tracking down why imaplib >would throw an unexpected response exception Have you forgotton how JPython-1.1 did this? Data was written as a through a Writer but reading data was through a InputStream. With no way of changing that behaviour. What we have now is better by far. >(on all correct >responses, except UID responses), but worked beautifully with cpython. >I am now submitting the patch below to cpython on sourceforge (that's >where the module is maintained, right? I know that the debian package >uses cpython's modules). It seems like this changes was submitted already: >http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=469910 I'll apply the same patch to jython's version of imaplib.py in the next release. regards, finn |