Use bit fields for flags to reduce memory usage.
Return booleans where they are documented. Although a boolean for
seekable seems a bit odd when it can be unknown. Add a comment about this.
api functions. Code from fileobject.c, patch by Amaury Forgeot d'Arc.
This patch also changes:
The return value of the native ftruncate function is checked for '!=
0' instead of '< 0' as before.
fileio_seekable returns bool now instead of an int.
to even the most basic file object (I also added readall() which may
be a better API). Also, not all the tests requiring specific failure
modes could be saved. And there were the usual str/bytes issues.
I made sure test_io.py still passes (io.py is now most thoroughly
tested by combining test_file.py and test_io.py).
PyString_Concat() and PyString_ConcatAndDel() (the name PyUnicode_Concat()
was already taken).
Change PyObject_Repr() to always return a unicode object.
Update all repr implementations to return unicode objects.
Add a function PyObject_ReprStr8() that calls PyObject_Repr() and converts
the result to an 8bit string.
Use PyObject_ReprStr8() where using PyObject_Repr() can't be done
straightforward.
Fix the truncate() semantics -- it should not affect the current position.
Switch wave.py/chunk.py to struct.unpack_from() to support bytes.
Don't use writelines() on binary files (test_fileinput.py).
write() returns the number of bytes/characters written/buffered.
FileIO.close() calls self.flush().
Implement readinto() for buffered readers.
Tests th check all these.
Test proper behavior of __enter__/__exit__.