reproducer.py:from contextlib import ExitStack
with ExitStack() as stack:
stack.enter_context(object())
pylint reproducer.py(Note that reproducer.py does raise an exception, but it does so _within_ enter_context, so the method does exist.)
# pylint reproducer.py
<snip>
example.py:4:4: E1101: Instance of 'AbstractContextManager' has no 'enter_context' member (no-member)
<snip>
Note that this behaviour does not exhibit on Python 3.7 (I haven't tried any other Python versions), and we only started seeing it when astroid moved to 2.3.0.
No no-member warning emitted.
pylint 2.4.1
astroid 2.3.0
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0]
(But I also saw it with pylint 2.3.0 and astroid 2.3.0.)
Thanks, I can reproduce it with 3.6.* as well.
This does not happen when using astroid 2.2.5. When stepping up to 2.3.0, it starts to show this error message
I am unable to "just" revert to astroid < 2.3 because then I run into #3022 :-(
So right now this issue appears to have no workaround.
So right now this issue appears to have no workaround.
I had to:
<2.3 to work around this issue.<2.4 to avoid it needing astroid 2.3 (#3022).This got my CI green again.
Any word on when this will be fixed @PCManticore?
This issue has disappeared for me after upgrading from pylint 2.4.4/astroid 2.3.3 to pylint 2.5.3/astroid 2.4.2. I don't see an obvious related fix mentioned in the changelog, but hey, an unexpected fix is still a fix!