From: dman <ds...@ri...> - 2001-11-06 22:11:15
|
Could someone please explain to me, again, why jython munges streams after the fashion of ms windows if binary mode isn't specified? I just had a real (annoying) waste of time tracking down why imaplib would throw an unexpected response exception (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). TIA, -D *** /usr/lib/python2.1/imaplib.py Sat Oct 20 10:48:35 2001 --- lib/modules/imaplib.py Tue Nov 6 16:59:15 2001 *************** *** 198,204 **** """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.file = self.sock.makefile('r') def recent(self): --- 198,206 ---- """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! # use binary mode -- with jython (java) not specifying binary mode ! # causes a CRLF->LF translation and screws up the data later on ! self.file = self.sock.makefile('rb') def recent(self): |