summaryrefslogtreecommitdiff
path: root/Lib/io.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/io.py')
-rw-r--r--Lib/io.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/io.py b/Lib/io.py
index e7533b5cfc..07846bfb83 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -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