summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-18 05:40:24 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-18 05:40:24 (GMT)
commit22cd7681777139a6c2409ea73cbcaf27fc2e5950 (patch)
tree3eb35e5f3eb1744b09f0526a8d93168bb7206a72 /Lib
parentdb2a902dee92a7569ad08ddff899955925a903e0 (diff)
downloadcpython-22cd7681777139a6c2409ea73cbcaf27fc2e5950.zip
cpython-22cd7681777139a6c2409ea73cbcaf27fc2e5950.tar.gz
cpython-22cd7681777139a6c2409ea73cbcaf27fc2e5950.tar.bz2
This module didn't work at all anymore -- blew up with AttributeError
on file.__methods__. Since the docs say "This module will become obsolete in a future release", this is just a quick hack to stop it from blowing up. If you care about this module, test it! It doesn't make much sense on Windows.
Diffstat (limited to 'Lib')
-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
#