Regression: no member contextlib #1444

Closed
powersj opened this Issue Apr 24, 2017 · 1 comment

Comments

Projects
None yet
3 participants

powersj commented Apr 24, 2017

Steps to reproduce

Use the following to reproduce and run pylint 1.7.1 on it:

#!/usr/bin/python
""" Test class for contextlib.closing.read"""
import contextlib
import urllib


with contextlib.closing(urllib.urlopen('http://www.python.org')) as gh:
    gh.read()

Current behavior

E: 8, 4: Instance of 'closing' has no 'read' member (no-member)

Expected behavior

No error reported

pylint --version output

pylint 1.7.1, 
astroid 1.5.2
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118]

Other information

No errors are reported under the previous version:

No config file found, using default configuration
pylint 1.6.5, 
astroid 1.4.9
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118]

Confirming read is a member:

$ python2
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
>>> import urllib
>>> with contextlib.closing(urllib.urlopen('http://www.python.org')) as gh:
...     dir(gh)
... 
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close', 'code', 'fileno', 'fp', 'getcode', 'geturl', 'headers', 'info', 'next', 'read', 'readline', 'readlines', 'url']

$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
>>> from urllib.request import urlopen
>>> with contextlib.closing(urlopen('http://www.python.org')) as gh:
...     dir(gh)
... 
['__abstractmethods__', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_abc_cache', '_abc_negative_cache', '_abc_negative_cache_version', '_abc_registry', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_check_close', '_close_conn', '_get_chunk_left', '_method', '_peek_chunked', '_read1_chunked', '_read_and_discard_trailer', '_read_next_chunk_size', '_read_status', '_readall_chunked', '_readinto_chunked', '_safe_read', '_safe_readinto', 'begin', 'chunk_left', 'chunked', 'close', 'closed', 'code', 'debuglevel', 'detach', 'fileno', 'flush', 'fp', 'getcode', 'getheader', 'getheaders', 'geturl', 'headers', 'info', 'isatty', 'isclosed', 'length', 'msg', 'peek', 'read', 'read1', 'readable', 'readinto', 'readinto1', 'readline', 'readlines', 'reason', 'seek', 'seekable', 'status', 'tell', 'truncate', 'url', 'version', 'will_close', 'writable', 'write', 'writelines']

@PCManticore PCManticore added the bug label Apr 27, 2017

smoser added a commit to cloud-init/cloud-init that referenced this issue May 22, 2017

tox: move pylint target to 1.7.1
The motivation for this is to make tip-pylint target green.
It does 2 things:
 a.) silence a warning that is generated in pylint 1.7.1, but not
     other versions of pylint.  This bug in pylint is filed at
     PyCQA/pylint#1444
 b.) move tox -e pylint to use pylint 1.7.1
Contributor

AWhetter commented Jul 8, 2017

Closing as a duplicate of #1437, but there's lots of extra information on here so thanks for the detail!

@AWhetter AWhetter closed this Jul 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment