I've concluded that my direction of travel must be ok, and have pushed a bunch of material today. It has been quite helpful to re-work that material in smaller increments.

I've noticed that a few of the failures in test_io are because the wrong type of exception is being raised. Also, test_fileio makes extensive accommodations to the fact that Jython throws a ValueError when CPython would throw an IOError. This mostly occurs in tests on an IO object where the underlying file has been closed by someone "behind its back". I've scratched my head most of the day about why this became necessary and can say with some confidence that it comes down to calling checkClosed() (or _checkClosed()) at the start of operations where CPython does not. checkClosed() raises ValueError, and checkReadable(), checkWritable() and checkSeekable() raise IOError. (These are correct behaviours in themselves.)

I've ventured a little way down the road of a possible solution. I think I could make Jython behave the same as CPython, and remove the concessions and skips that allow us to get away with the divergence, by removing or re-thinking these tests. Each operation has its nuances to be dealt with case by case, but that's the essence of it.

Quite a few of these checks are in io.FileIO and ancestors, rather than _io.PyFileIO. I'm trying to change the former as little as I can, but this would change nearly every method (in a small way). Does anyone (Philip particularly) foresee impacts to other code that I might not notice in testing?

Jeff Allen

On 03/11/2012 19:40, Jeff Allen wrote:
On 02/11/2012 19:39, Philip Jenvey wrote:
On Nov 2, 2012, at 2:18 AM, Jeff Allen wrote:

I have been following a design, outlined at the start of this thread, that involves delegation to the implementation Philip Jenvey has given us in org.python.core.io. I'm now convinced this won't work as planned. ...
Jeff, it'd be great if you could put the code up, say on your bitbucket account, then we could probably have a better look

I now have a Bitbucket account. (What great facility once over the 
learning curve!) I have pushed the code I am working on to this repo:

I'd be grateful for thoughts about whether the delegation pattern that 
seemed promising at the start can deliver the inheritance behaviour we need.


LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
Jython-dev mailing list