-
- Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
I get a `no-member` error for attributes of a generic dataclass when running with the new astroid 2.15.7. This is true for both pylint 2.17.5 and the new pylint 2.17.6. $ cat p.py # pylint: disable=missing-module-docstring invalid-name missing-class-docstring from dataclasses import dataclass from typing import Generic, TypeVar T_Inner = TypeVar("T_Inner", bound="Inner") @dataclass class Inner: inner_attribute: str @dataclass class Outer(Generic[T_Inner]): inner: T_Inner x = Outer(inner=Inner(inner_attribute="magic xylophone")) print(x.inner.inner_attribute)Configuration
No response
Command used
$ python3.11 --version --version Python 3.11.2 (main, Mar 5 2023, 21:14:41) [GCC 11.3.0]$ rm -rf venv$ python3.11 -m venv venv && venv/bin/pip install pylint==2.17.6 astroid==2.15.7 Collecting pylint==2.17.6 Using cached pylint-2.17.6-py3-none-any.whl (537 kB) Collecting astroid==2.15.7 Using cached astroid-2.15.7-py3-none-any.whl (278 kB) Collecting platformdirs>=2.2.0 Using cached platformdirs-3.10.0-py3-none-any.whl (17 kB) Collecting isort<6,>=4.2.5 Using cached isort-5.12.0-py3-none-any.whl (91 kB) Collecting mccabe<0.8,>=0.6 Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) Collecting tomlkit>=0.10.1 Using cached tomlkit-0.12.1-py3-none-any.whl (37 kB) Collecting dill>=0.3.6 Using cached dill-0.3.7-py3-none-any.whl (115 kB) Collecting lazy-object-proxy>=1.4.0 Using cached lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (64 kB) Collecting wrapt<2,>=1.14 Using cached wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78 kB) Installing collected packages: wrapt, tomlkit, platformdirs, mccabe, lazy-object-proxy, isort, dill, astroid, pylint Successfully installed astroid-2.15.7 dill-0.3.7 isort-5.12.0 lazy-object-proxy-1.9.0 mccabe-0.7.0 platformdirs-3.10.0 pylint-2.17.6 tomlkit-0.12.1 wrapt-1.15.0 [notice] A new release of pip available: 22.3.1 -> 23.2.1 [notice] To update, run: /home/altendky/tmp/blue/venv/bin/python3.11 -m pip install --upgrade pip$ venv/bin/pylint p.py ************* Module p p.py:20:6: E1101: Instance of 'T_Inner' has no 'inner_attribute' member (no-member) ------------------------------------------------------------------- Your code has been rated at 4.44/10 (previous run: 10.00/10, -5.56) $ rm -rf venv$ python3.11 -m venv venv && venv/bin/pip install pylint==2.17.5 astroid==2.15.7 Collecting pylint==2.17.5 Using cached pylint-2.17.5-py3-none-any.whl (536 kB) Collecting astroid==2.15.7 Using cached astroid-2.15.7-py3-none-any.whl (278 kB) Collecting platformdirs>=2.2.0 Using cached platformdirs-3.10.0-py3-none-any.whl (17 kB) Collecting isort<6,>=4.2.5 Using cached isort-5.12.0-py3-none-any.whl (91 kB) Collecting mccabe<0.8,>=0.6 Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) Collecting tomlkit>=0.10.1 Using cached tomlkit-0.12.1-py3-none-any.whl (37 kB) Collecting dill>=0.3.6 Using cached dill-0.3.7-py3-none-any.whl (115 kB) Collecting lazy-object-proxy>=1.4.0 Using cached lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (64 kB) Collecting wrapt<2,>=1.14 Using cached wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78 kB) Installing collected packages: wrapt, tomlkit, platformdirs, mccabe, lazy-object-proxy, isort, dill, astroid, pylint Successfully installed astroid-2.15.7 dill-0.3.7 isort-5.12.0 lazy-object-proxy-1.9.0 mccabe-0.7.0 platformdirs-3.10.0 pylint-2.17.5 tomlkit-0.12.1 wrapt-1.15.0 [notice] A new release of pip available: 22.3.1 -> 23.2.1 [notice] To update, run: /home/altendky/tmp/blue/venv/bin/python3.11 -m pip install --upgrade pip$ venv/bin/pylint p.py ************* Module p p.py:20:6: E1101: Instance of 'T_Inner' has no 'inner_attribute' member (no-member) ------------------------------------------------------------------ Your code has been rated at 4.44/10 (previous run: 4.44/10, +0.00) Pylint output
************* Module p p.py:20:6: E1101: Instance of 'T_Inner' has no 'inner_attribute' member (no-member) ------------------------------------------------------------------ Your code has been rated at 4.44/10 (previous run: 4.44/10, +0.00)Expected behavior
$ rm -rf venv$ python3.11 -m venv venv && venv/bin/pip install pylint==2.17.5 astroid==2.15.6 Collecting pylint==2.17.5 Using cached pylint-2.17.5-py3-none-any.whl (536 kB) Collecting astroid==2.15.6 Using cached astroid-2.15.6-py3-none-any.whl (278 kB) Collecting platformdirs>=2.2.0 Using cached platformdirs-3.10.0-py3-none-any.whl (17 kB) Collecting isort<6,>=4.2.5 Using cached isort-5.12.0-py3-none-any.whl (91 kB) Collecting mccabe<0.8,>=0.6 Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) Collecting tomlkit>=0.10.1 Using cached tomlkit-0.12.1-py3-none-any.whl (37 kB) Collecting dill>=0.3.6 Using cached dill-0.3.7-py3-none-any.whl (115 kB) Collecting lazy-object-proxy>=1.4.0 Using cached lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (64 kB) Collecting wrapt<2,>=1.14 Using cached wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78 kB) Installing collected packages: wrapt, tomlkit, platformdirs, mccabe, lazy-object-proxy, isort, dill, astroid, pylint Successfully installed astroid-2.15.6 dill-0.3.7 isort-5.12.0 lazy-object-proxy-1.9.0 mccabe-0.7.0 platformdirs-3.10.0 pylint-2.17.5 tomlkit-0.12.1 wrapt-1.15.0 [notice] A new release of pip available: 22.3.1 -> 23.2.1 [notice] To update, run: /home/altendky/tmp/blue/venv/bin/python3.11 -m pip install --upgrade pip$ venv/bin/pylint p.py ------------------------------------------------------------------- Your code has been rated at 10.00/10 (previous run: 4.44/10, +5.56) Pylint version
$ venv/bin/pylint --version pylint 2.17.6 astroid 2.15.7 Python 3.11.2 (main, Mar 5 2023, 21:14:41) [GCC 11.3.0]$ venv/bin/pylint --version pylint 2.17.5 astroid 2.15.7 Python 3.11.2 (main, Mar 5 2023, 21:14:41) [GCC 11.3.0]OS / Environment
$ uname -a Linux p1 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/LinuxAdditional dependencies
No response
Metadata
Metadata
Assignees
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation