diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-28 21:10:17 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-28 21:10:17 (GMT) |
commit | c83b629996ca183eaceb3d3b7ede4312ee5cb675 (patch) | |
tree | 37f21b09ba1dd75aa46b072f6c8655ab00fa2486 /Lib/tempfile.py | |
parent | e1feb2ebb29a4d27013902dfaf7b7e3dcac65fde (diff) | |
download | cpython-c83b629996ca183eaceb3d3b7ede4312ee5cb675.zip cpython-c83b629996ca183eaceb3d3b7ede4312ee5cb675.tar.gz cpython-c83b629996ca183eaceb3d3b7ede4312ee5cb675.tar.bz2 |
iter() doesn't use __getattr__ to find an __iter__ method. I'm not sure if the behavior is deliberately but this workaround fixes the issue for the next alpha release tomorrow.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 4f27f61..11a4c60 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -394,6 +394,10 @@ class _TemporaryFileWrapper: self.file.__enter__() return self + # XXX iter() doesn't use __getattr__ to find the __iter__ method + def __iter__(self): + return self.__getattr__('__iter__')() + # NT provides delete-on-close as a primitive, so we don't need # the wrapper to do anything special. We still use it so that # file.name is useful (i.e. not "(fdopen)") with NamedTemporaryFile. |