diff options
author | Guido van Rossum <guido@python.org> | 2007-10-19 23:16:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-10-19 23:16:50 (GMT) |
commit | ce3a72aec6eaa0293c397c8d0407f7afe0072b2f (patch) | |
tree | 646cf27667087a48b908f330759fb94271b43f60 /Lib/io.py | |
parent | 75a902db7859a4751743e98530c5d96a672641be (diff) | |
download | cpython-ce3a72aec6eaa0293c397c8d0407f7afe0072b2f.zip cpython-ce3a72aec6eaa0293c397c8d0407f7afe0072b2f.tar.gz cpython-ce3a72aec6eaa0293c397c8d0407f7afe0072b2f.tar.bz2 |
Patch 1267 by Christian Heimes.
Move the initialization of sys.std{in,out,err} and __builtin__.open
to C code.
This solves the problem that "python -S" wouldn't work.
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -178,6 +178,18 @@ def open(file, mode="r", buffering=None, encoding=None, newline=None): return text +class OpenWrapper: + """Wrapper for __builtin__.open + + Trick so that open won't become a bound method when stored + as a class variable (as dumbdbm does). + + See initstdio() in Python/pythonrun.c. + """ + def __new__(cls, *args, **kwargs): + return open(*args, **kwargs) + + class UnsupportedOperation(ValueError, IOError): pass |