diff options
author | Guido van Rossum <guido@python.org> | 2007-03-08 00:43:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-03-08 00:43:48 (GMT) |
commit | a9e2024b8443959cc906958d161afe9f0d08bc25 (patch) | |
tree | e90d1893c99002ba822e9f7e9b4c41ce79923774 /Lib/io.py | |
parent | 4d0f5a4934854207948115b14b4643a6cb600a0d (diff) | |
download | cpython-a9e2024b8443959cc906958d161afe9f0d08bc25.zip cpython-a9e2024b8443959cc906958d161afe9f0d08bc25.tar.gz cpython-a9e2024b8443959cc906958d161afe9f0d08bc25.tar.bz2 |
Check in Daniel Stutzbach's _fileio.c and test_fileio.py
(see SF#1671314) with small tweaks.
The io module now uses this instead of its own implementation
of the FileIO class, if it can import _fileio.
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -177,7 +177,7 @@ class RawIOBase: raise IOError(".fileno() not supported") -class FileIO(RawIOBase): +class _PyFileIO(RawIOBase): """Raw I/O implementation for OS files.""" @@ -243,6 +243,18 @@ class FileIO(RawIOBase): return self._fd +try: + import _fileio +except ImportError: + # Let's use the Python version + FileIO = _PyFileIO +else: + # Create a trivial subclass with the proper inheritance structure + class FileIO(_fileio._FileIO, RawIOBase): + """Raw I/O implementation for OS files.""" + # XXX More docs + + class SocketIO(RawIOBase): """Raw I/O implementation for stream sockets.""" |