[Python-3000-checkins] r61114 - python/branches/py3k/Lib/tempfile.py

Guido van Rossum guido at python.org
Thu Feb 28 23:12:18 CET 2008


IMO it should be

def __iter__(self):
  return iter(self.file)

On Thu, Feb 28, 2008 at 1:10 PM, christian.heimes
<python-3000-checkins at python.org> wrote:
> Author: christian.heimes
>  Date: Thu Feb 28 22:10:17 2008
>  New Revision: 61114
>
>  Modified:
>    python/branches/py3k/Lib/tempfile.py
>  Log:
>  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.
>
>  Modified: python/branches/py3k/Lib/tempfile.py
>  ==============================================================================
>  --- python/branches/py3k/Lib/tempfile.py        (original)
>  +++ python/branches/py3k/Lib/tempfile.py        Thu Feb 28 22:10:17 2008
>  @@ -394,6 +394,10 @@
>          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.
>  _______________________________________________
>  Python-3000-checkins mailing list
>  Python-3000-checkins at python.org
>  http://mail.python.org/mailman/listinfo/python-3000-checkins
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000-checkins mailing list