-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive no-member
with @contextmanager
decorated generators
#2567
Comments
Thanks for the report, definitely a bug. |
And for import contextlib
@contextlib.contextmanager
def context_manager():
try:
yield
finally:
pass
with context_manager:
pass have an error
|
@Vihrastik You need to call import contextlib
@contextlib.contextmanager
def context_manager():
try:
yield
finally:
pass
with context_manager(): # notice the function call
pass |
no, i just forgot to write it in the example of code. this error is active with call. |
Hi. I wanted to work on this issue if nobody minds. Regarding snippet import contextlib
@contextlib.contextmanager
def context_manager():
try:
yield
finally:
pass
with context_manager():
pass which @Vihrastik reports to However when I created local env with pylint from master (2.4.0.dev0) / astroid 2.2.5 I receive |
Fix (no-member) false-positives for generators created with contextmanager (pylint-dev#2567)
Hi @gyermolenko Feel free to tackle this issue! Regarding your issue with |
Fix (no-member) false-positives for generators created with contextmanager (pylint-dev#2567)
Fix (no-member) false-positives for generators created with contextmanager (pylint-dev#2567)
no-member
with @contextmanager
decorated generators
I'm not able to reproduce this second issue, but I am able to reproduce original issue raised at the top. |
@DanielNoord I thought maybe the changes in pylint-dev/astroid#1810 would fix the initial FP, but it's still present. What else needs to happen in astroid? |
Have you checked out |
There's two PR left for astroid 2.13.0, you can follow progress here: https://github.com/PyCQA/astroid/milestone/40 |
Score! Testing this out on astroid main solves this issue. Will update labels and hopefully can be closed once 2.13.0 is out. |
@clavedeluna 2.13.2 is out, the pylint PR is #8030 |
Finally, in what versions of Pylint / Astroid it is fixed ? I'm using Fedora 38 and this is triggered in spite of relatively new versions. |
The milestone is 2.16.0 here, please open a new issue if there was a regression :) |
I have this little snippet:
pylint signals the "direct" access to the __enter__ and __exit__ callables as an error:
while "uncommon" at least, I think it should not be marked as an error.
The text was updated successfully, but these errors were encountered: