OK, I see what you're getting at. backwardcompat.fwrite is (IMO) badly named, because it's actually intended to be a way of doing a write+flush. The access to the buffer property doesn't actually help with this at all, and actually screws up the bytes/string distinction.

I actually think that backwardcompat.fwrite could be removed, as all it actually does is write then flush. I've updated this PR with the relevant change - let's see if travis is OK with it (it passes tests locally, but I'm getting paranoid :-()