]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
iter() doesn't use __getattr__ to find an __iter__ method. I'm not sure if the behavi...
authorChristian Heimes <christian@cheimes.de>
Thu, 28 Feb 2008 21:10:17 +0000 (21:10 +0000)
committerChristian Heimes <christian@cheimes.de>
Thu, 28 Feb 2008 21:10:17 +0000 (21:10 +0000)
Lib/tempfile.py

index 4f27f614a19312a607a30dd91891ac2198b89178..11a4c60e2dcd26f6175c315fc0cb3543311fbe20 100644 (file)
@@ -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.