On 3/7/07, Alan Kennedy <jython-dev@...> wrote:
> Hmm, I'm not getting your natural language description here. Can you
> please post code?
> What I suspect is happening is that the (pseudo) file is being opened
> in "Text" mode, i.e. like this
> pseudofile = mysocket.makefile()
You're probably right about what's happening. Cherrypy does this:
self.rfile = sock.makefile("r", self.rbufsize) #
cherrypy.wsgiserver.__init__ line 593
makefile in the "old" jython socket module (for _tcpsocket) looks like this:
def makefile(self, mode="r", bufsize=-1):
file = None
file = org.python.core.PyFile(self.istream, self.ostream,
file = org.python.core.PyFile(self.istream, "<socket>", mode)
file = org.python.core.PyFile(self.ostream, "<socket>", mode)
raise IOError, "both istream and ostream have been shut down"
return _tcpsocket.FileWrapper(self, file)
In CPython on the other hand it looks like this:
def makefile(self, mode='r', bufsize=-1):
return _fileobject(self._sock, mode, bufsize)
If I just replace the jython module with this one (and of course
include the _fileobject class) my particular use case works as
cherrypy expects it to do.