summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/posixfile.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/posixfile.py b/Lib/posixfile.py
index 589510d..dcd65cd 100644
--- a/Lib/posixfile.py
+++ b/Lib/posixfile.py
@@ -75,12 +75,16 @@ class _posixfile_:
return self.fileopen(__builtin__.open(name, mode, bufsize))
def fileopen(self, file):
+ import types
if `type(file)` != "<type 'file'>":
raise TypeError, 'posixfile.fileopen() arg must be file object'
self._file_ = file
# Copy basic file methods
- for method in file.__methods__:
- setattr(self, method, getattr(file, method))
+ for maybemethod in dir(file):
+ if not maybemethod.startswith('_'):
+ attr = getattr(file, maybemethod)
+ if isinstance(attr, types.BuiltinMethodType):
+ setattr(self, maybemethod, attr)
return self
#