-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable
Milestone
Description
Bug description
Following:
import psycopg
with psycopg.connect('...') as conn:
pass...raises E1129 (not-context-manager) violation.
But the code works fine and sources look ok as psycopg.connect() returns Connection class (which indeed has __enter__ and __exit__).
I'm running psycopg==3.0.1.
Configuration
No response
Command used
pylintPylint output
************* Module foo
foo.py:3:0: E1129: Context manager 'NoneType' doesn't implement __enter__ and __exit__. (not-context-manager)
--------------------------------------------------------------------
Your code has been rated at -6.67/10 (previous run: -6.67/10, +0.00)Expected behavior
There shouldn't be error.
Pylint version
pylint 2.11.1
astroid 2.8.4
Python 3.8.12 (default, Nov 6 2021, 14:26:37)
[GCC 9.3.0]OS / Environment
Kubuntu 20.04 LTS
Additional dependencies
No response
rchen152, rhoban13, jackiescanlon, jontwo, evgenymarkov and 4 more
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergable