We've recently started to see pylint flag issues on a piece of code that looks 
similar to this -

---------------------------------------
#!/bin/python

"""
Test the TemporaryFile iterator
"""

import os
import tempfile

with tempfile.TemporaryFile() as nullfh:
    nullfh.write(b'Hello world!')
    nullfh.seek(0, os.SEEK_SET)
    for line in nullfh:
        line = line.strip()
        print line

---------------------------------------
With 
pylint 1.7.1, 
astroid 1.5.2
Python 2.7.5 (default, Nov  6 2016, 00:28:07)

This reports - 

E: 13,16: Non-iterable value nullfh is used in an iterating context 
(not-an-iterable)

However the code is functional so nullfh does work in the iterating context.

Any clues as to why this is being flagged would be appreciated.

Thanks,

Mark.
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to