You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pylint can't resolve psycopg connection class members if the connection is assigned to a variable before using its context manager.
that fails:
"""dummy docstring"""importpsycopgclient=psycopg.connect("dbname=test user=postgres")
withclient:
version=client.execute(
""" CREATE TABLE test ( id serial PRIMARY KEY, num integer, data text) """
).fetchone()
while the following passes:
"""dummy docstring"""importpsycopgwithpsycopg.connect("dbname=test user=postgres") asclient:
version=client.execute(
""" CREATE TABLE test ( id serial PRIMARY KEY, num integer, data text) """
).fetchone()
pip install psycopg==3.2.4
pylint my_test_file.py
************* Modulemy_test_file
bad_psycopg.py:7:11: E1101: Class 'value' has no 'cursor' member (no-member)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Bug description
Pylint can't resolve psycopg connection class members if the connection is assigned to a variable before using its context manager.
that fails:
while the following passes:
Configuration
Command used
Pylint output
Expected behavior
No error triggered
Pylint version
OS / Environment
macos 15.3, ubuntu 22.04
Additional dependencies
The text was updated successfully, but these errors were encountered: