all_hints_text
string
base_commit
string
commit_urls
list
created_at
timestamp[s]
hints_text
string
instance_id
string
issue_numbers
list
language
string
patch
string
problem_statement
string
pull_number
string
repo
string
test_patch
string
version
string
FAIL_TO_PASS
list
PASS_TO_PASS
list
test_cmds
list
log_parser
string
difficulty
dict
Makes sense. This happens because the inference for functions looks through each return value here (https://github.com/PyCQA/astroid/blob/629c92db2dc1b016f4bf47645c95c42e65fd3bd6/astroid/scoped_nodes.py#L1558) and tries to infer the result from there. But since functions like this don't have an explicit return value...
53a20335357bbd734d74c3bfe22e3518f74f4d11
[ "https://github.com/pylint-dev/astroid/commit/4a53ef4b151ace595608b5b5e6008b7b17914a80", "https://github.com/pylint-dev/astroid/commit/38297611b6ebf32cd7722cce3074ce8fccccb490", "https://github.com/pylint-dev/astroid/commit/826d0e95fd6800fff5f32f66e911b0a30dbfa982", "https://github.com/pylint-dev/astroid/comm...
2021-05-01T03:28:27
Makes sense. This happens because the inference for functions looks through each return value here (https://github.com/PyCQA/astroid/blob/629c92db2dc1b016f4bf47645c95c42e65fd3bd6/astroid/scoped_nodes.py#L1558) and tries to infer the result from there. But since functions like this don't have an explicit return value...
pylint-dev__astroid-983
[ "485" ]
python
diff --git a/ChangeLog b/ChangeLog index c606b76106..8ba9ea37bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,11 @@ Release Date: TBA Closes #904 +* Allow inferring a return value of None for non-abstract empty functions and + functions with no return statements (implicitly returning None) + + Closes #48...
Cannot infer empty functions ### Steps to reproduce ```python import astroid astroid.extract_node(""" def f(): pass f() """).inferred() ``` ### Current behavior raises `StopIteration` ### Expected behavior Returns `[const.NoneType]` ### ``python -c "from astroid import __pkginfo__; print(__pkginfo_...
983
pylint-dev/astroid
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 6b9f4c0609..2e88891637 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -706,14 +706,6 @@ class InvalidGetitem2(object): NoGetitem()[4] #@ InvalidGetitem()[5] #@ InvalidGetitem2()[10] #@ ...
none
[ "tests/unittest_scoped_nodes.py::FunctionNodeTest::test_abstract_methods_are_not_implicitly_none", "tests/unittest_scoped_nodes.py::FunctionNodeTest::test_no_returns_is_implicitly_none", "tests/unittest_scoped_nodes.py::FunctionNodeTest::test_only_raises_is_not_implicitly_none" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA tests/" ]
pytest
{ "files": 3, "hunks": 5, "lines": 23 }
Some notes: - The `ModuleNotFoundError` exception is thrown by `importlib.util.find_spec`. Before python 3.7 this was an `AttributeError` - `modutils.is_relative()` is the call-site for the `find_spec` call - It seems that `is_ralative()` is trying to find a parent mod-spec for the anchor `from_file` parameter so ...
d2394a3e24236106355418e102b1bb0f1bef879c
[ "https://github.com/pylint-dev/astroid/commit/86edd7d157592d84853dece3122507cb303b326d", "https://github.com/pylint-dev/astroid/commit/6b4b4a1f7349062782999342b8ca43f95fe37f59", "https://github.com/pylint-dev/astroid/commit/d2a72366b4cd6699a8a5828dbc75f6694b07e058", "https://github.com/pylint-dev/astroid/comm...
2021-05-01T16:13:04
Some notes: - The `ModuleNotFoundError` exception is thrown by `importlib.util.find_spec`. Before python 3.7 this was an `AttributeError` - `modutils.is_relative()` is the call-site for the `find_spec` call - It seems that `is_ralative()` is trying to find a parent mod-spec for the anchor `from_file` parameter so ...
pylint-dev__astroid-984
[ "930" ]
python
diff --git a/ChangeLog b/ChangeLog index 8ba9ea37bb..3252b48719 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ What's New in astroid 2.6.0? ============================ Release Date: TBA +* Fix detection of relative imports. + Closes #930 + Closes PyCQA/pylint#4186 + * Fix inference of instance attribut...
Pyreverse regression after #857 (astroid 2.5) ### Steps to reproduce 1. Checkout pylint's source (which contains pyreverse) 1. cd `<pylint checkout>` 2. Run `source .tox/py39/bin/activate` or similar (you may need to run a tox session first) 3. Ensure you have `astroid` ac2b173bc8acd2d08f6b6ffe29dd8cda0b2c8814 or ...
984
pylint-dev/astroid
diff --git a/tests/unittest_modutils.py b/tests/unittest_modutils.py index 958659f542..248a88cdb9 100644 --- a/tests/unittest_modutils.py +++ b/tests/unittest_modutils.py @@ -301,6 +301,18 @@ def test_knownValues_is_relative_1(self): def test_knownValues_is_relative_3(self): self.assertFalse(modutils.is_r...
none
[ "tests/unittest_modutils.py::IsRelativeTest::test_knownValues_is_relative_4", "tests/unittest_modutils.py::IsRelativeTest::test_knownValues_is_relative_5" ]
[ "tests/unittest_modutils.py::ModuleFileTest::test_find_egg_module", "tests/unittest_modutils.py::ModuleFileTest::test_find_zipped_module", "tests/unittest_modutils.py::LoadModuleFromNameTest::test_knownValues_load_module_from_name_1", "tests/unittest_modutils.py::LoadModuleFromNameTest::test_knownValues_load_...
[ "pytest -rA" ]
pytest
{ "files": 4, "hunks": 6, "lines": 37 }
Minimal case: ```python class Example: def func(self): pass whatthe = object() whatthe.func = None ex = Example() ex.func() # false-positive: not-callable ``` Not caused by 78d5537, just revealed by it. `typing` imported `collections`, `collections.OrderedDict` had an ambiguously inferred...
2c109eec6fe3f972c6e8c637fe956431a0d7685c
[ "https://github.com/pylint-dev/astroid/commit/957c832d049708d5e3a8e47c13231afe38914b39", "https://github.com/pylint-dev/astroid/commit/09558a0743c6130b472f6b4ea1c2a44fdb5a3e77", "https://github.com/pylint-dev/astroid/commit/5b9916b67c4d75b3ed4d33c1eb93f4197da0d16c", "https://github.com/pylint-dev/astroid/comm...
2021-04-13T12:30:06
Minimal case: ```python class Example: def func(self): pass whatthe = object() whatthe.func = None ex = Example() ex.func() # false-positive: not-callable ``` Not caused by 78d5537, just revealed by it. `typing` imported `collections`, `collections.OrderedDict` had an ambiguously inferred...
pylint-dev__astroid-946
[ "945" ]
python
diff --git a/ChangeLog b/ChangeLog index b4af947daa..12fae5ceab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,15 @@ What's New in astroid 2.6.0? ============================ Release Date: TBA +* Do not set instance attributes on builtin object() + + Closes #945 + Closes PyCQA/pylint#4232 + Closes PyCQA/pylint#4...
Delayed attribute assignment to object() may cause incorrect inference of instance attributes @cdce8p: `aiohttp` and `VLCTelnet` turned out to be red herrings. This case fails on current stable versions: ```python class Example: def prev(self): pass def next(self): pass def other(se...
946
pylint-dev/astroid
diff --git a/tests/unittest_builder.py b/tests/unittest_builder.py index a48d341999..ce9abf9af0 100644 --- a/tests/unittest_builder.py +++ b/tests/unittest_builder.py @@ -28,7 +28,7 @@ import pytest -from astroid import builder, exceptions, manager, nodes, test_utils, util +from astroid import Instance, builder, e...
none
[ "tests/unittest_builder.py::BuilderTest::test_infer_can_assign_no_classdict" ]
[ "tests/unittest_builder.py::FromToLineNoTest::test_callfunc_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_class_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_decorated_function_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_for_while_lineno", "tests/unittest_builder....
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 2, "lines": 11 }
Looks like this is caused by https://github.com/PyCQA/astroid/blob/f2b197a4f8af0ceeddf435747a5c937c8632872a/astroid/scoped_nodes.py#L2590-L2603. When we are inferring an attribute on a derived class then `class_context` is `True` but `metaclass` is `False` so the property itself is returned.
962becc0ae86c16f7b33140f43cd6ed8f1e8a045
[ "https://github.com/pylint-dev/astroid/commit/dbc9c0c0a01744bf9b654e750b2dbd03d80f3ed5", "https://github.com/pylint-dev/astroid/commit/857f15448fbfbecd488f8bdfdeb315b2950b37d0", "https://github.com/pylint-dev/astroid/commit/8030d6ab76a8696294d5d8f297ad7193b953e9d5", "https://github.com/pylint-dev/astroid/comm...
2021-04-11T11:57:22
Looks like this is caused by https://github.com/PyCQA/astroid/blob/f2b197a4f8af0ceeddf435747a5c937c8632872a/astroid/scoped_nodes.py#L2590-L2603. When we are inferring an attribute on a derived class then `class_context` is `True` but `metaclass` is `False` so the property itself is returned.
pylint-dev__astroid-941
[ "940" ]
python
diff --git a/ChangeLog b/ChangeLog index 4343be3fee..9d7b945fde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,15 @@ Release Date: TBA Closes #898 +* Fix property inference in class contexts for properties defined on the metaclass + + Closes #940 + +* Update enum brain to fix definition of __members__ for ...
@property members defined in metaclasses of a base class are not correctly inferred Ref https://github.com/PyCQA/astroid/issues/927#issuecomment-817244963 Inference works on the parent class but not the child in the following example: ```python class BaseMeta(type): @property def __members__(cls): ...
941
pylint-dev/astroid
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py index 9303f1c7eb..7fe537b2fb 100644 --- a/tests/unittest_scoped_nodes.py +++ b/tests/unittest_scoped_nodes.py @@ -1923,6 +1923,153 @@ def update(self): builder.parse(data) +def test_issue940_metaclass_subclass_property(): + nod...
none
[ "tests/unittest_scoped_nodes.py::test_issue940_metaclass_subclass_property", "tests/unittest_scoped_nodes.py::test_issue940_enums_as_a_real_world_usecase" ]
[ "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_dict_interface", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_api", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_in_memory", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_physical", "tests/uni...
[ "pytest -rA tests/" ]
pytest
{ "files": 3, "hunks": 5, "lines": 30 }
The first issue is caused by the fact that the `str` relies on `postinit` being called I think. I ran into this while debugging `astroid` many times.. I made a quick unit test on #2198. Am I going in the right direction? Also, I guess fixing the errors themselves will be part of this issue right? I'd prefer using `p...
61ca2e832dd1f99ed7de5c7c403031292993d6fd
[ "https://github.com/pylint-dev/astroid/commit/f5028e230d4d0320e31af5f7014f08ba0b0666aa" ]
2023-06-06T20:17:57
The first issue is caused by the fact that the `str` relies on `postinit` being called I think. I ran into this while debugging `astroid` many times..
pylint-dev__astroid-2198
[ "1881" ]
python
diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 977469df90..af2d270e1b 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -210,7 +210,7 @@ def __str__(self) -> str: alignment = len(cname) + 1 result = [] for field in self._other_fields + self._a...
Some `__str__` methods of nodes raise errors and warnings ### Steps to reproduce ```python >>> fd = astroid.nodes.FunctionDef() >>> str(fd) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/jacobwalls/astroid/astroid/nodes/node_ng.py", line 219, in __str__ value = getatt...
2198
pylint-dev/astroid
diff --git a/tests/test_nodes.py b/tests/test_nodes.py index 6303bbef28..d5c017dfc4 100644 --- a/tests/test_nodes.py +++ b/tests/test_nodes.py @@ -7,7 +7,9 @@ from __future__ import annotations import copy +import inspect import os +import random import sys import textwrap import unittest @@ -1880,3 +1882,35 @@...
none
[ "tests/test_nodes.py::test_str_repr_no_warnings[AnnAssign]", "tests/test_nodes.py::test_str_repr_no_warnings[Arguments]", "tests/test_nodes.py::test_str_repr_no_warnings[Assert]", "tests/test_nodes.py::test_str_repr_no_warnings[Assign]", "tests/test_nodes.py::test_str_repr_no_warnings[AssignAttr]", "tests...
[ "tests/test_nodes.py::AsStringTest::test_3k_annotations_and_metaclass", "tests/test_nodes.py::AsStringTest::test_3k_as_string", "tests/test_nodes.py::AsStringTest::test_as_string", "tests/test_nodes.py::AsStringTest::test_as_string_for_list_containing_uninferable", "tests/test_nodes.py::AsStringTest::test_a...
[ "pytest -rA" ]
pytest
{ "files": 1, "hunks": 3, "lines": 9 }
I can work around it by replacing `...` with `yield`, but it doesn't seem that this should be necessary (and it wasn't in prior versions of Astroid). And it is hard to satisfy mypy with this workaround, because it expects `yield [value]` etc. @belm0 thanks for the report. The issue seems to have started with #934, the...
12ed435a97be78ce2d00f9ef818ec65d54f5ca82
[ "https://github.com/pylint-dev/astroid/commit/4113a8f61ee3e9a8d5ff021f1bc02f96f2f532c7", "https://github.com/pylint-dev/astroid/commit/5a86f413705fcb9ccb20d4a7d8716e003420f24b", "https://github.com/pylint-dev/astroid/commit/38bb9c0b18b3a5f3038ef633ce250c411e7d6552", "https://github.com/pylint-dev/astroid/comm...
2021-09-15T08:41:50
I can work around it by replacing `...` with `yield`, but it doesn't seem that this should be necessary (and it wasn't in prior versions of Astroid). And it is hard to satisfy mypy with this workaround, because it expects `yield [value]` etc. @belm0 thanks for the report. The issue seems to have started with #934, the...
pylint-dev__astroid-1173
[ "1015" ]
python
diff --git a/ChangeLog b/ChangeLog index 86b614c1f6..ac5df56f4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,11 @@ What's New in astroid 3.2.0? ============================ Release date: TBA +* ``igetattr()`` returns the last same-named function in a class (instead of + the first). This avoids false positives...
false not-an-iterable for class method with @overload (2.5.7 regression) ### Steps to reproduce Starting from astroid 2.5.7, I'm seeing false not-an-iterable when generator class methods are annotated with `@overload`. ```python from typing import overload, Iterator class MyClass: @overload def tran...
1173
pylint-dev/astroid
diff --git a/tests/test_inference.py b/tests/test_inference.py index ffd78fe035..10fceb7b56 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -30,7 +30,7 @@ ) from astroid import decorators as decoratorsmod from astroid.arguments import CallSite -from astroid.bases import BoundMethod, Instance, U...
none
[ "tests/test_inference.py::InferenceTest::test_infer_method_overload" ]
[ "tests/test_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/test_inference.py::InferenceTest::test__new__", "tests/test_inference.py::InferenceTest::test__new__bound_methods", "tests/test_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/test_inference.py::Inferenc...
[ "pytest -rA" ]
pytest
{ "files": 2, "hunks": 2, "lines": 16 }
Hi @eugene57 Can I work on this issue? Sure, I assigned you to the issue @pavan-msys :)
34fbf2ed10fdd3ce244c12584683f40ac3af984a
[ "https://github.com/pylint-dev/astroid/commit/05f0aa9594a069ffdd8c58776796bf6edb9161ff", "https://github.com/pylint-dev/astroid/commit/d0da3a29bfeff4b2a18969d4eaa3996156698967" ]
2025-05-26T16:30:17
Hi @eugene57 Can I work on this issue? Sure, I assigned you to the issue @pavan-msys :)
pylint-dev__astroid-2756
[ "2608" ]
python
diff --git a/ChangeLog b/ChangeLog index 22ed00a05..d8fdfd63e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,10 @@ Release date: TBA * Modify ``astroid.bases`` and ``tests.test_nodes`` to reflect that `enum.property` was added in Python 3.11, not 3.10 +* Fix incorrect result in `_get_relative_base_path` when ...
modutils._get_relative_base_path returns incorrect result when directory name starts with directory name in path_to_check Consider following call: `astroid.modutils._get_relative_base_path('something', os.path.join(os.getcwd(), 'some'))`. I would expect this to return `None` by design. However, this returns `'thing'` i...
2756
pylint-dev/astroid
diff --git a/tests/test_get_relative_base_path.py b/tests/test_get_relative_base_path.py new file mode 100644 index 000000000..ddf35588a --- /dev/null +++ b/tests/test_get_relative_base_path.py @@ -0,0 +1,119 @@ +# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html +# For details: https...
none
[ "tests/test_get_relative_base_path.py::TestModUtilsRelativePath::test_similar_prefixes_no_match" ]
[ "tests/test_get_relative_base_path.py::TestModUtilsRelativePath::test_case_sensitivity", "tests/test_get_relative_base_path.py::TestModUtilsRelativePath::test_empty_paths", "tests/test_get_relative_base_path.py::TestModUtilsRelativePath::test_nonexistent_paths", "tests/test_get_relative_base_path.py::TestModU...
[ "pytest -rA" ]
pytest
{ "files": 2, "hunks": 3, "lines": 31 }
OSS-Fuzz discovered another `IndexError` when there's only one argument to `_alias` ([OSS-Fuzz bug report](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64639)): ```python a = _alias(int) ``` ``` Traceback (most recent call last): File "pylint/pylint/checkers/utils.py", line 1365, in safe_infer ...
a8439ff4f822cde57151f083d987a7b7ed593fbf
[ "https://github.com/pylint-dev/astroid/commit/58a3c28feac91b84dba9fe1a9aed54478616d709" ]
2024-10-23T17:48:15
OSS-Fuzz discovered another `IndexError` when there's only one argument to `_alias` ([OSS-Fuzz bug report](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64639)): ```python a = _alias(int) ``` ``` Traceback (most recent call last): File "pylint/pylint/checkers/utils.py", line 1365, in safe_infer ...
pylint-dev__astroid-2623
[ "2513" ]
python
diff --git a/ChangeLog b/ChangeLog index 036f888e08..8ab5375b4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,10 @@ Release date: TBA Closes #2521 Closes #2523 +* Fix crash when typing._alias() call is missing arguments. + + Closes #2513 + What's New in astroid 3.3.6? ============================ dif...
IndexError when _alias() has no arguments ### Bug description ```python _alias() ``` This bug was discovered by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57984 (report not public yet) ### Configuration ```ini N/A ``` ### Command used ```shell pylint a.py ``` ### ...
2623
pylint-dev/astroid
diff --git a/tests/brain/test_typing.py b/tests/brain/test_typing.py index 1e8e3eaf88..11b77b7f9e 100644 --- a/tests/brain/test_typing.py +++ b/tests/brain/test_typing.py @@ -4,7 +4,7 @@ import pytest -from astroid import builder +from astroid import bases, builder, nodes from astroid.exceptions import InferenceE...
none
[ "tests/brain/test_typing.py::TestTypingAlias::test_infer_typing_alias_incorrect_number_of_arguments[]", "tests/brain/test_typing.py::TestTypingAlias::test_infer_typing_alias_incorrect_number_of_arguments[int]", "tests/brain/test_typing.py::TestTypingAlias::test_infer_typing_alias_incorrect_number_of_arguments[i...
[ "tests/brain/test_typing.py::test_infer_typevar", "tests/brain/test_typing.py::TestTypingAlias::test_infer_typing_alias" ]
[ "pytest -rA" ]
pytest
{ "files": 2, "hunks": 2, "lines": 5 }
Thank you for opening the issue. I don't believe `Unknown().as_string()` is ever called regularly. AFAIK it's only used during inference. What should the string representation of an `Unknown` node be? So not sure this needs to be addressed. Probably just `'Unknown'`. It's mostly only a problem when we do something like...
ce5cbce5ba11cdc2f8139ade66feea1e181a7944
[ "https://github.com/pylint-dev/astroid/commit/eb3b3a21ff08ca50fb3abbaf4b5229f923596caf", "https://github.com/pylint-dev/astroid/commit/81fbae69befe04663f433ba471662aee90951aa1", "https://github.com/pylint-dev/astroid/commit/9b6ebb18f75f49da85fd3543b71ed532911b1ede" ]
2021-11-21T16:15:23
Thank you for opening the issue. I don't believe `Unknown().as_string()` is ever called regularly. AFAIK it's only used during inference. What should the string representation of an `Unknown` node be? So not sure this needs to be addressed. Probably just `'Unknown'`. It's mostly only a problem when we do something like...
pylint-dev__astroid-1268
[ "1264" ]
python
diff --git a/ChangeLog b/ChangeLog index 0f047d393c..944b76f91c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ Release date: TBA * Always treat ``__class_getitem__`` as a classmethod. +* Add missing ``as_string`` visitor method for ``Unknown`` node. + + Closes #1264 + What's New in astroid 2.8.6? ===...
'AsStringVisitor' object has no attribute 'visit_unknown' ```python >>> import astroid >>> astroid.nodes.Unknown().as_string() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tusharsadhwani/code/marvin-python/venv/lib/python3.9/site-packages/astroid/nodes/node_ng.py", line 6...
1268
pylint-dev/astroid
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 7c78cd23ed..8c860eac3a 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -306,6 +306,11 @@ def test_f_strings(self): ast = abuilder.string_build(code) self.assertEqual(ast.as_string().strip(), code.strip()) + ...
none
[ "tests/unittest_nodes.py::AsStringTest::test_as_string_unknown" ]
[ "tests/unittest_nodes.py::AsStringTest::test_3k_annotations_and_metaclass", "tests/unittest_nodes.py::AsStringTest::test_3k_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string_for_list_containing_uninferable", "tests/unittest_nodes.py::...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 3, "lines": 8 }
0824812ed2999413f00d80fa58805b1b47c1ccc5
[ "https://github.com/pylint-dev/astroid/commit/ef7520df9bbd7e387e6e131ab17d250b5d5da692", "https://github.com/pylint-dev/astroid/commit/1f04c7ce746c83feab077e0462e058fbbb2253fe", "https://github.com/pylint-dev/astroid/commit/650e1ab916ac48cfc1fb3d42fd0df94f9845b508", "https://github.com/pylint-dev/astroid/comm...
2022-06-07T10:37:43
pylint-dev__astroid-1602
[ "104" ]
python
diff --git a/ChangeLog b/ChangeLog index 7db3e6c682..4cc346a478 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ Release date: TBA Closes PyCQA/pylint#3518 +* Calls to ``str.format`` are now correctly inferred. + + Closes #104 + * Adds missing enums from ``ssl`` module. Closes PyCQA/pylint#3691 d...
String formatting is inferred as empty string Originally reported by: **Florian Bruhin (BitBucket: [The-Compiler](http://bitbucket.org/The-Compiler), GitHub: @The-Compiler?)** --- With this code: ``` py def foo(arg): pass foo('foo{}bar'.format(42)) foo('const') ``` The first call is inferred as an empty string...
1602
pylint-dev/astroid
diff --git a/tests/unittest_brain_builtin.py b/tests/unittest_brain_builtin.py index 0d7493034a..a659c4fdf2 100644 --- a/tests/unittest_brain_builtin.py +++ b/tests/unittest_brain_builtin.py @@ -6,12 +6,15 @@ import unittest -from astroid import extract_node, objects +import pytest + +from astroid import nodes, ob...
none
[ "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[numbered-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[named-indexes]", "tests/unittest_brain_builtin.py::TestStringNo...
[ "tests/unittest_brain_builtin.py::BuiltinsTest::test_infer_property", "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::Inferen...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 3, "lines": 50 }
ec96745c0fdb9432549d182e381164d1836e8a4b
[ "https://github.com/pylint-dev/astroid/commit/e712edced04a26e12e2aed94e555d6e2a25c9d4d" ]
2020-06-20T00:58:26
pylint-dev__astroid-805
[ "777" ]
python
diff --git a/ChangeLog b/ChangeLog index 737b682ec4..c8c6bcfb1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Release Date: TBA Fixes PyCQA/pylint#3599 +* Prevent recursion error for self referential length calls + + Close #777 + * Added missing methods to the brain for ``mechanize``, to fix pylint...
Astroid Infinite loop when `__len__(self)` is mistakenly defined as `return len(self)` ### Steps to reproduce Lint the following program with pylint ```python class Crash: def __len__(self) -> int: return len(self) ``` ### Current behavior The following error is thrown and pylint crashes ``` R...
805
pylint-dev/astroid
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index 25e2bb5b73..c308ddd535 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -2035,5 +2035,21 @@ def test_str_and_bytes(code, expected_class, expected_value): assert inferred.value == expected_value +def test_no_recursionerror...
none
[ "tests/unittest_brain.py::test_no_recursionerror_on_self_referential_length_check" ]
[ "tests/unittest_brain.py::HashlibTest::test_hashlib", "tests/unittest_brain.py::HashlibTest::test_hashlib_py36", "tests/unittest_brain.py::CollectionsDequeTests::test_deque", "tests/unittest_brain.py::CollectionsDequeTests::test_deque_py35methods", "tests/unittest_brain.py::OrderedDictTest::test_ordered_dic...
[ "pytest -rA tests" ]
pytest
{ "files": 3, "hunks": 3, "lines": 25 }
Sorry for taking so long to get back to this. I think it is very likely that we might refactor `AstroidManager` in our efforts to fix our multiprocessing issues. That is why I'm inclined to leave this issue for now and see if it still exists after the refactor and what our stance would then be. Ended up in the same pla...
bb0573d876e91ff66c4ca59369e3d292681f6bd3
[ "https://github.com/pylint-dev/astroid/commit/3bbf264934aff17d49cf743f2982f153fa0ed2e6", "https://github.com/pylint-dev/astroid/commit/2add5ab0bea7fbe6f971f06c2112b57ccb069fbe" ]
2023-06-07T20:34:42
Sorry for taking so long to get back to this. I think it is very likely that we might refactor `AstroidManager` in our efforts to fix our multiprocessing issues. That is why I'm inclined to leave this issue for now and see if it still exists after the refactor and what our stance would then be. Ended up in the same pla...
pylint-dev__astroid-2206
[ "2041" ]
python
diff --git a/astroid/nodes/_base_nodes.py b/astroid/nodes/_base_nodes.py index 3ef97b580c..c79fec799b 100644 --- a/astroid/nodes/_base_nodes.py +++ b/astroid/nodes/_base_nodes.py @@ -130,8 +130,11 @@ def do_import_module(self, modname: str | None = None) -> nodes.Module: # If the module ImportNode is importing...
regression introduced in 2.13.0 (from 2.12.14) concerning `use_cache` in astroid's cache This PR (#1747) introduced a regression in 2.13.0 (from 2.12.14). This regression causes undesired side effects — at least to me :-). I rely on `AstroidManager.astroid_cache` to provide "special" implementations for certain modu...
2206
pylint-dev/astroid
diff --git a/tests/test_inference.py b/tests/test_inference.py index 29bf56ac2c..868c83bc5f 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -22,6 +22,7 @@ Uninferable, arguments, helpers, + manager, nodes, objects, test_utils, @@ -991,6 +992,16 @@ def test_import_a...
none
[ "tests/test_inference.py::InferenceTest::test_do_import_module_performance" ]
[ "tests/test_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/test_inference.py::InferenceTest::test__new__", "tests/test_inference.py::InferenceTest::test__new__bound_methods", "tests/test_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/test_inference.py::Inferenc...
[ ". venv/bin/activate && pytest -rA" ]
pytest
{ "files": 1, "hunks": 1, "lines": 7 }
Hi, thanks for the report. I tried to reproduce this but I was not able, can you paste the exact code you used to demonstrate the issue? @PCManticore, reproducibility of this one is straightforward to me, here's a (partial) example — but note that I had a typo in the original snippet: I missed the colon after `type`, w...
5f67396894c79c4661e357ec8bb03aa134a51109
[ "https://github.com/pylint-dev/astroid/commit/217aa531a438c3b25cea8ecfd1bb0b834f5bc4f8" ]
2021-01-31T06:43:56
Hi, thanks for the report. I tried to reproduce this but I was not able, can you paste the exact code you used to demonstrate the issue? @PCManticore, reproducibility of this one is straightforward to me, here's a (partial) example — but note that I had a typo in the original snippet: I missed the colon after `type`, w...
pylint-dev__astroid-887
[ "851" ]
python
diff --git a/ChangeLog b/ChangeLog index 9ff42a6e77..be30ed4525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -119,6 +119,13 @@ Release Date: TBA Close PyCQA/pylint#3904 +* Corrected the parent of function type comment nodes. + + These nodes used to be parented to their original ast.FunctionDef parent + but are no...
calling `parent` on a node that is part of a type comment returns the (original) `_ast` module's FunctionDef Consider this snippet: ```python def f(s): # type: (str) -> int return 42 ``` Given the `node` from the type comment, `Name.int(name='int')`, if I call its parent (i.e., `node.parent`), I get t...
887
pylint-dev/astroid
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index d138ee1704..0ba6b3e541 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -1181,6 +1181,19 @@ def f_arg_comment( assert actual_arg.as_string() == expected_arg +@pytest.mark.skipif(not HAS_TYPED_AST, reason="requ...
none
[ "tests/unittest_nodes.py::test_correct_function_type_comment_parent" ]
[ "tests/unittest_nodes.py::AsStringTest::test_3k_annotations_and_metaclass", "tests/unittest_nodes.py::AsStringTest::test_3k_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string_for_list_containing_uninferable", "tests/unittest_nodes.py::...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 4, "lines": 15 }
6280a758733434cba32b719519908314a5c2955b
[ "https://github.com/pylint-dev/astroid/commit/4e8eca77e4cd577ec8b812ac2da92a96077c953d", "https://github.com/pylint-dev/astroid/commit/cc49adde8ee7cb8ae23ec0e80f86063ad5de702c" ]
2022-06-12T11:50:45
pylint-dev__astroid-1616
[ "1611" ]
python
diff --git a/ChangeLog b/ChangeLog index bcf244b1d9..262c3af41d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,7 @@ Release date: TBA * Calls to ``str.format`` are now correctly inferred. - Closes #104 + Closes #104, Closes #1611 * Adds missing enums from ``ssl`` module. diff --git a/astroid/brain/brai...
Infer calls to str.format() on names Future enhancement could infer this value instead of giving an empty string: ```python from astroid import extract_node call = extract_node(""" x = 'python is {}' x.format('helpful sometimes') """) call.inferred()[0].value # gives "" ``` _Originally posted by @jacobtyl...
1616
pylint-dev/astroid
diff --git a/tests/unittest_brain_builtin.py b/tests/unittest_brain_builtin.py index 54e7d2190d..dd99444b1f 100644 --- a/tests/unittest_brain_builtin.py +++ b/tests/unittest_brain_builtin.py @@ -66,6 +66,13 @@ class TestStringNodes: """, id="mixed-indexes-from-mixed", ), + ...
none
[ "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes-on-variable]" ]
[ "tests/unittest_brain_builtin.py::BuiltinsTest::test_infer_property", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[numbered-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 3, "lines": 24 }
I believe [this change](https://github.com/timmartin/astroid/commit/ffa6bcb757797c3ab2aebd8b9f29018a7022d9ea) will fix this, I just need to write a proper PR. I think the problem is that when we run multiple inferences in `_inferred_bases`, the context is reused which means the second and subsequent inferences have ...
46297774d1a0e57815500a50b2323ea906bd50da
[ "https://github.com/pylint-dev/astroid/commit/7f1d5134d89aab9b3e49030676637debfd731dbb", "https://github.com/pylint-dev/astroid/commit/c89dc0102bfe7a6e72b21e213742bdb982b438cc", "https://github.com/pylint-dev/astroid/commit/c9c579206a21a00acb7f8fcca0d8f530e3daedef" ]
2020-10-13T18:57:21
pylint-dev__astroid-844
[ "843" ]
python
diff --git a/ChangeLog b/ChangeLog index a5a0be55d2..27a61f00ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,10 @@ Release Date: TBA * Fixed exception-chaining error messages. +* Fix failure to infer base class type with multiple inheritance and qualified names + + Fixes #843 + * Reduce memory usage of as...
Incorrect MRO inferred with multiple inheritance from module-qualified classes ### Steps to reproduce File `other.py`: class A: pass class B: pass Then run: import astroid class_node = astroid.extract_node(""" import other class Child(other.A, other.B): #@...
844
pylint-dev/astroid
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py index c4597fa686..aef1a671fe 100644 --- a/tests/unittest_scoped_nodes.py +++ b/tests/unittest_scoped_nodes.py @@ -1417,6 +1417,22 @@ def __init__(self): ], ) + def test_mro_with_attribute_classes(self): + cls ...
none
[ "tests/unittest_scoped_nodes.py::ClassNodeTest::test_mro_with_attribute_classes" ]
[ "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_dict_interface", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_api", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_in_memory", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_file_stream_physical", "tests/uni...
[ "pytest -rA tests", "pytest -rA tests -maxfail=5 --disable-warnings", "pytest -rA tests --maxfail=5 -p no:warnings" ]
pytest
{ "files": 2, "hunks": 2, "lines": 6 }
0a697736138703c37571ac92d274e4ab0ee7adc3
[ "https://github.com/pylint-dev/astroid/commit/6b3e9f95ccf2d41948d8925d1095ffebb7e5dcdb", "https://github.com/pylint-dev/astroid/commit/123499ffcdea28d7d4ab7a65b3e96d99a5707b52", "https://github.com/pylint-dev/astroid/commit/0c7c5396c95acf931ad0b740566c0c249c8d00f9" ]
2021-08-27T14:44:00
pylint-dev__astroid-1151
[ "1008" ]
python
diff --git a/ChangeLog b/ChangeLog index a8bf1711cc..b79ee7c264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,20 @@ What's New in astroid 2.8.0? ============================ Release date: TBA +* Fixed bug in attribute inference from inside method calls. + + Closes PyCQA/pylint#400 + +* Fixed bug in inference...
Incorrect inference of `self` in methods defined in superclasses in unbound methods on a subclass ### Steps to reproduce ```python import astroid node = astroid.extract_node(""" class Base: def replace(self): return self class Derived(Base): def method(self): return 123 this = Deri...
1151
pylint-dev/astroid
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index eac809e4e6..8653fab6e0 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -2384,14 +2384,27 @@ class LambdaInstance(object): __neg__ = lambda self: self.lala + 1 @property def l...
none
[ "tests/unittest_inference_calls.py::test_method_dynamic_instance_attr_3", "tests/unittest_inference_calls.py::test_method_dynamic_instance_attr_5", "tests/unittest_inference_calls.py::test_method_dynamic_instance_attr_6", "tests/unittest_inference_calls.py::test_dunder_getitem", "tests/unittest_inference_ca...
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA tests" ]
pytest
{ "files": 8, "hunks": 18, "lines": 110 }
Thanks for creating the issue @degustaf Yes, this is still a design goal that we'd want to achieve with `astroid`. There are two reasons for why this didn't happen yet, the first one being the one that you identified about not having enough time to do it. The second one is that it's a rather tricky issue, since the...
8d57ce2f3e226c2ac3cdd7f6a57dac2dd5ec5a4b
[ "https://github.com/pylint-dev/astroid/commit/ed843e9a5d4dfb4f5cd7885055c8b388d325a22c", "https://github.com/pylint-dev/astroid/commit/60f02def33c977b2712f946412027b992cf8f801", "https://github.com/pylint-dev/astroid/commit/e910116a7c2d2ce714d03748348ab07409d49f1e", "https://github.com/pylint-dev/astroid/comm...
2023-05-08T15:00:30
Thanks for creating the issue @degustaf Yes, this is still a design goal that we'd want to achieve with `astroid`. There are two reasons for why this didn't happen yet, the first one being the one that you identified about not having enough time to do it. The second one is that it's a rather tricky issue, since the...
pylint-dev__astroid-2171
[ "679" ]
python
diff --git a/ChangeLog b/ChangeLog index d05a19c909..0a4414809d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,13 @@ Release date: TBA Closes #1780 Refs #2140 +* Remove the ``inference`` module. Node inference methods are now in the module + defining the node, rather than being associated to the node afte...
Remove monkey-patching of methods onto classes In [this comment](https://github.com/PyCQA/astroid/issues/170#issuecomment-163118573), @PCManticore stated that there was a plan to remove monkey-patching of methods onto classes. inference.py and protocols.py seem to suggest that this hasn't happened. Is this still a d...
2171
pylint-dev/astroid
diff --git a/tests/test_inference.py b/tests/test_inference.py index 96778b89d3..03d0e2c744 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -41,7 +41,6 @@ InferenceError, NotFoundError, ) -from astroid.inference import infer_end as inference_infer_end from astroid.objects import Except...
none
[ "tests/test_manager.py::ClearCacheTest::test_clear_cache_clears_other_lru_caches" ]
[ "tests/test_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/test_inference.py::InferenceTest::test__new__", "tests/test_inference.py::InferenceTest::test__new__bound_methods", "tests/test_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/test_inference.py::Inferenc...
[ "pytest -rA" ]
pytest
{ "files": 16, "hunks": 112, "lines": 3075 }
I'm seeing similar 2.5-related issues with Enum subclasses. Particularly, `Enum.__members__.items()`. Pylint complains about `__members__` have not member `items` which is incorrect. With pylint 2.6.2, and astroid 2.4.2, everything is fine. With astroid 2.5: (note lazy_object_proxy 1.5.2 is present) Traceback (mo...
0f97f79c0aa50ed0506c09db729f906450b37652
[ "https://github.com/pylint-dev/astroid/commit/ac0d01e5f0fcc5bc58bf31e5d95fd08dfa35a118", "https://github.com/pylint-dev/astroid/commit/4b1aefcfda6b2de4b86fd6d2b813cc47008cce7a", "https://github.com/pylint-dev/astroid/commit/6f885833bc27a5f2ac6555d75cdb0786fa74b08a", "https://github.com/pylint-dev/astroid/comm...
2021-02-17T11:37:55
I'm seeing similar 2.5-related issues with Enum subclasses. Particularly, `Enum.__members__.items()`. Pylint complains about `__members__` have not member `items` which is incorrect. With pylint 2.6.2, and astroid 2.4.2, everything is fine. With astroid 2.5: (note lazy_object_proxy 1.5.2 is present) Traceback (mo...
pylint-dev__astroid-901
[ "895" ]
python
diff --git a/ChangeLog b/ChangeLog index 2c454cb8df..519fa249f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,15 @@ astroid's ChangeLog =================== +What's New in astroid 2.5.1? +============================ +Release Date: TBA + +* The ``context.path`` is reverted to a set because otherwise it leds to f...
Unexpected error from pylint after upgrade to astroid 2.5. ### Steps to reproduce astroid 2.5 pylint 2.6.0 elasticsearch 7.10.1 python 3.7.3 ``` from elasticsearch import Elasticsearch es = Elasticsearch(["test"]) es.indices.delete(index="test", ignore=[400, 404]) ``` 1. run pylint ### Current behavior l...
901
pylint-dev/astroid
diff --git a/tests/unittest_brain_numpy_core_umath.py b/tests/unittest_brain_numpy_core_umath.py index f384ea2539..593c9f89f9 100644 --- a/tests/unittest_brain_numpy_core_umath.py +++ b/tests/unittest_brain_numpy_core_umath.py @@ -226,9 +226,11 @@ def test_numpy_core_umath_functions_return_type(self): with...
none
[ "tests/unittest_inference.py::InferenceTest::test_no_runtime_error_in_repeat_inference", "tests/unittest_inference.py::InferenceTest::test_subscript_inference_error" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test_With_metaclass_subclasses_arguments_are_classes_not_instances", "tests/unittest_inference.py::InferenceTest::test_With_metaclass_with_partial_imported_name", "tests/unittest_inference.py::In...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 4, "lines": 19 }
dc13d5b66cec53b26b3c04df07f14724588a09a6
[ "https://github.com/pylint-dev/astroid/commit/8bd53f0ed71058981cf0bb37ba41511ce77f199b" ]
2023-12-12T05:18:57
pylint-dev__astroid-2345
[ "2071" ]
python
diff --git a/ChangeLog b/ChangeLog index 7b49fdf5b3..f0940c60d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,11 @@ Release date: TBA Refs pylint-dev/pylint#9193 +* Add ``__main__`` as a possible inferred value for ``__name__`` to improve + control flow inference around ``if __name__ == "__main__":`` guar...
Should infer more values for `== __name__` (possibly other dunders) ### Steps to reproduce ```python >>> n = extract_node("if __name__ == '__main__': ...") >>> n.test.inferred() [<Const.bool l.None at 0x10baadf90>] >>> n.test.inferred()[0] <Const.bool l.None at 0x10c71eb50> >>> n.test.inferred()[0].value False...
2345
pylint-dev/astroid
diff --git a/tests/test_scoped_nodes.py b/tests/test_scoped_nodes.py index 1bc5af78b6..995f0428d9 100644 --- a/tests/test_scoped_nodes.py +++ b/tests/test_scoped_nodes.py @@ -79,9 +79,11 @@ def setUp(self) -> None: class ModuleNodeTest(ModuleLoader, unittest.TestCase): def test_special_attributes(self) -> None:...
none
[ "tests/test_scoped_nodes.py::ModuleNodeTest::test_special_attributes" ]
[ "tests/test_scoped_nodes.py::ModuleNodeTest::test_comment_before_docstring", "tests/test_scoped_nodes.py::ModuleNodeTest::test_dict_interface", "tests/test_scoped_nodes.py::ModuleNodeTest::test_file_stream_api", "tests/test_scoped_nodes.py::ModuleNodeTest::test_file_stream_in_memory", "tests/test_scoped_nod...
[ "pytest -rA --cov" ]
pytest
{ "files": 2, "hunks": 3, "lines": 17 }
Timing the pylint evaluation of checkers/ folder from pylint repo, I don't see a big difference with and without (explicit raise KeyError inserted) the cache: with: ``` real 0m57.994s real 0m58.089s real 0m57.446s real 0m57.366s ``` without: ``` real 0m58.913s real 0m58.693s real 0m59.0...
06fafc4d023460c682494672b617d456037baf67
[ "https://github.com/pylint-dev/astroid/commit/d1b73d13d9fb75005bf3c2eb176aff9818f7762b", "https://github.com/pylint-dev/astroid/commit/171c48bb80b66b0a6da3eb33d38a1ea8d612de52", "https://github.com/pylint-dev/astroid/commit/07719871e7ff8b113589cc26c464a862e20bb816", "https://github.com/pylint-dev/astroid/comm...
2023-04-30T13:52:13
Timing the pylint evaluation of checkers/ folder from pylint repo, I don't see a big difference with and without (explicit raise KeyError inserted) the cache: with: ``` real 0m57.994s real 0m58.089s real 0m57.446s real 0m57.366s ``` without: ``` real 0m58.913s real 0m58.693s real 0m59.0...
pylint-dev__astroid-2158
[ "1828" ]
python
diff --git a/ChangeLog b/ChangeLog index a760172d10..faccda681d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,13 @@ Release date: TBA * Reduce file system access in ``ast_from_file()``. +* Fix incorrect cache keys for inference results, thereby correctly inferring types + for calls instantiating types dynam...
Wrong type inferred - inference type cache is missing context Moving discussion started in https://github.com/PyCQA/pylint/issues/7464 to astroid repo. ### Steps to reproduce ``` import astroid result1, result2 = astroid.extract_node(""" class Base: def return_type(self): return type(self)() ...
2158
pylint-dev/astroid
diff --git a/tests/brain/test_brain.py b/tests/brain/test_brain.py index 00a023ddb0..4a016868cb 100644 --- a/tests/brain/test_brain.py +++ b/tests/brain/test_brain.py @@ -930,13 +930,7 @@ class A: assert inferred.value == 42 def test_typing_cast_multiple_inference_calls(self) -> None: - """Infere...
none
[ "tests/brain/test_brain.py::TypingBrain::test_typing_cast_multiple_inference_calls", "tests/test_regrtest.py::NonRegressionTests::test_inference_context_consideration", "tests/test_scoped_nodes.py::ClassNodeTest::test_mro_with_factories" ]
[ "tests/brain/test_brain.py::CollectionsDequeTests::test_deque", "tests/brain/test_brain.py::CollectionsDequeTests::test_deque_py35methods", "tests/brain/test_brain.py::CollectionsDequeTests::test_deque_py39methods", "tests/brain/test_brain.py::OrderedDictTest::test_ordered_dict_py34method", "tests/brain/tes...
[ "pytest -rA" ]
pytest
{ "files": 2, "hunks": 4, "lines": 37 }
It appears that this is caused by `InferenceContext` maintaining a strong reference to the mutable set that is shared between clones, see this simplified example: ```python class Context: def __init__(self, path=None): self.path = path or set() def clone(self): return Context(path=self.p...
cd8b6a43192724128af68605ef22aabf3254f495
[ "https://github.com/pylint-dev/astroid/commit/ed77a1ba3d762497005f2c5f3d6a4839135ce341", "https://github.com/pylint-dev/astroid/commit/c4bf1579a4bcd97dd03c52093462b6b657515b3c", "https://github.com/pylint-dev/astroid/commit/f581d935509be60f1b4ef3c3b3dcbfa60c2946e9", "https://github.com/pylint-dev/astroid/comm...
2021-03-29T12:55:48
pylint-dev__astroid-927
[ "926" ]
python
diff --git a/ChangeLog b/ChangeLog index 12fae5ceab..05d9256b7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,11 @@ Release Date: TBA Closes PyCQA/pylint#3970 Closes PyCQA/pylint#3595 +* Fix some spurious cycles detected in ``context.path`` leading to more cases + that can now be inferred + + Closes #926 ...
infer_stmts cannot infer multiple uses of the same AssignName Given multiple assignments to the same target which both reference the same AssignName, infer_stmts fails for subsequent attempts after the first. ### Steps to reproduce This appears to be a minimum working example, removing any part removes the effect...
927
pylint-dev/astroid
diff --git a/tests/unittest_brain_numpy_core_umath.py b/tests/unittest_brain_numpy_core_umath.py index 12c1e3bbbc..5559bdd581 100644 --- a/tests/unittest_brain_numpy_core_umath.py +++ b/tests/unittest_brain_numpy_core_umath.py @@ -14,7 +14,7 @@ except ImportError: HAS_NUMPY = False -from astroid import bases, b...
none
[ "tests/unittest_inference.py::InferenceTest::test_stop_iteration_leak", "tests/unittest_inference.py::test_issue926_infer_stmts_referencing_same_name_is_not_uninferable", "tests/unittest_inference.py::test_issue926_binop_referencing_same_name_is_not_uninferable" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA" ]
pytest
{ "files": 2, "hunks": 2, "lines": 7 }
@federicobond thanks for this suggestion!
d19758108727e1fd11e343d857d060d4f80655d1
[ "https://github.com/pylint-dev/astroid/commit/5d706d40ce55157b01636791e18d7a00e3fe5d49" ]
2021-04-12T04:26:06
@federicobond thanks for this suggestion!
pylint-dev__astroid-943
[ "898" ]
python
diff --git a/ChangeLog b/ChangeLog index 63e9816d51..4343be3fee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,11 @@ Release Date: TBA Closes #926 +* Add ``kind`` field to ``Const`` nodes, matching the structure of the built-in ast Const. + The kind field is "u" if the literal is a u-prefixed string, and `...
Add kind field to Const Python 3.8 added the optional `kind` field to `ast.Constant`. This is used to store the string prefix, like `u` for `u"foo"`. `astroid.Const` should include this field too.
943
pylint-dev/astroid
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 4ce73be9b8..14f713a51b 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -542,6 +542,19 @@ def test_str(self): def test_unicode(self): self._test("a") + @pytest.mark.skipif( + not PY38, reason="kind attrib...
none
[ "tests/unittest_nodes.py::ConstNodeTest::test_str_kind" ]
[ "tests/unittest_nodes.py::AsStringTest::test_3k_annotations_and_metaclass", "tests/unittest_nodes.py::AsStringTest::test_3k_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string_for_list_containing_uninferable", "tests/unittest_nodes.py::...
[ "pytest -rA --pyargs tests" ]
pytest
{ "files": 3, "hunks": 5, "lines": 17 }
I think the same issue applies to `list`, `set` and `bytearray`. I think we can deal with all these at the same time.
a39bbcea62f918668cf12aa269e2a5d145e76df9
[ "https://github.com/pylint-dev/astroid/commit/a3cbcaacfa47fc4532bb0e5e9425eb769dbd9882", "https://github.com/pylint-dev/astroid/commit/a9131b4f9705d9e0ac5ced4ae6742e5eb0659d1c", "https://github.com/pylint-dev/astroid/commit/9002d778bea0a8216664bb736f78684249bc144e", "https://github.com/pylint-dev/astroid/comm...
2022-05-03T20:33:08
I think the same issue applies to `list`, `set` and `bytearray`. I think we can deal with all these at the same time.
pylint-dev__astroid-1540
[ "1403" ]
python
diff --git a/ChangeLog b/ChangeLog index a418b1b7af..cf1004721e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,10 @@ Release date: TBA * Rename ``ModuleSpec`` -> ``module_type`` constructor parameter to match attribute name and improve typing. Use ``type`` instead. +* Infer the return value of the ``.copy()`...
dict.copy() result is not inferred as dict ### Steps to reproduce Run this code: ```python import astroid code = """ x = dict() y = x.copy() """ ast = astroid.parse(code) for name in ('x', 'y'): node = ast.locals[name][0] print(name, node.inferred()) ``` ### Current behavior x [<Dict.dict l....
1540
pylint-dev/astroid
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 4069d0f320..5b6f09b283 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -2051,6 +2051,37 @@ def test_dict_invalid_args(self) -> None: self.assertIsInstance(inferred, Instance) self.assertE...
none
[ "tests/unittest_inference.py::InferenceTest::test_copy_method_inference" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 4, "lines": 30 }
82b94253ac4165d8a49854e2685da63cea01f2e6
[ "https://github.com/pylint-dev/astroid/commit/b0a88e4503b16ddeb306eabf4fe1313d223f15ec", "https://github.com/pylint-dev/astroid/commit/c1edabc2d13cd989e08847a77bca7f53e28f3d91", "https://github.com/pylint-dev/astroid/commit/cf76d1a0839b49b95b01e9f07a75fb65ae3237fe" ]
2021-10-09T08:16:46
pylint-dev__astroid-1209
[ "1208" ]
python
diff --git a/ChangeLog b/ChangeLog index b0a2db8880..9088e7bbc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,11 @@ Release date: TBA * Add support for wrapt 1.13 +* Fixes handling of nested partial functions + + Closes pyCQA/pylint#2462 + Closes #1208 + What's New in astroid 2.8.2? ===================...
Nested partial functions lose track of previously-filled args/kwargs ### Steps to reproduce Cause of issue [#2462](https://github.com/PyCQA/pylint/issues/2462) for `pylint` ### Current behavior ```python node = astroid.extract_node( """ from functools import partial def test(a, b, c): return a + b...
1209
pylint-dev/astroid
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index e3362c925a..722e163180 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -2986,6 +2986,34 @@ def scope(): assert set(mod_scope) == {"test", "scope", "partial"} assert set(scope) == {"test2"} + def test_multip...
none
[ "tests/unittest_brain.py::TestFunctoolsPartial::test_multiple_partial_args" ]
[ "tests/unittest_brain.py::HashlibTest::test_hashlib", "tests/unittest_brain.py::HashlibTest::test_hashlib_py36", "tests/unittest_brain.py::CollectionsDequeTests::test_deque", "tests/unittest_brain.py::CollectionsDequeTests::test_deque_py35methods", "tests/unittest_brain.py::CollectionsDequeTests::test_deque...
[ ". venv/bin/activate && pytest -rA" ]
pytest
{ "files": 2, "hunks": 2, "lines": 17 }
Possible duplicate of #1008 This problem is due to the fact `_infer_context_manager` takes caller function, using its current context, instead of the original callers context. This may be fixed for example by adding data to `Generator` instance, by `infer_call_result` that signifies its possible value types. I'm no...
c9c498348174b38ce35bfe001353c8ebea262802
[ "https://github.com/pylint-dev/astroid/commit/5ba74b0ba63b8e5fb403a0fff251064cd45315b1", "https://github.com/pylint-dev/astroid/commit/be4e22dfc9e665f1660488e682718d3da378745b", "https://github.com/pylint-dev/astroid/commit/74ea8d2d5414d2f3835ee1fe3c9ef3432e1a4e4d", "https://github.com/pylint-dev/astroid/comm...
2021-07-10T10:44:32
pylint-dev__astroid-1092
[ "1090" ]
python
diff --git a/ChangeLog b/ChangeLog index 98110ede8e..ed9739bb5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,11 @@ What's New in astroid 2.6.3? ============================ Release date: TBA + +* Fix a bad inferenece type for yield values inside of a derived class. + + Closes PyCQA/astroid#1090 + * Fix a c...
Yield self is inferred to be of a mistaken type ### Steps to reproduce 1. Run the following ``` import astroid print(list(astroid.parse(''' import contextlib class A: @contextlib.contextmanager def get(self): yield self class B(A): def play(): pass with B().get() as...
1092
pylint-dev/astroid
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 1fe83dc8c7..afc24dc28e 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -6154,5 +6154,26 @@ def test_issue926_binop_referencing_same_name_is_not_uninferable(): assert inferred[0].value == 3 +def test_issue...
none
[ "tests/unittest_inference.py::test_issue_1090_infer_yield_type_base_class" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA tests/" ]
pytest
{ "files": 4, "hunks": 6, "lines": 47 }
> but I thought we wanted these to be accessible on all nodes, just initialised as None. Yeah, that was the idea initially. > `AttributeError` on both of the last lines. For now a workaround would be to use `hasattr(node, "end_lineno")`. Not pretty but it should do. That should unblock https://github.com/PyCQA...
e840a7c54d3d8b5be2db1e66f34a5368c64fc3f7
[ "https://github.com/pylint-dev/astroid/commit/dbe50556d926d02ac3dca62dc778679597ed3afc", "https://github.com/pylint-dev/astroid/commit/77ba9a31916f896ebc32a87caff87d3d7165ea6d", "https://github.com/pylint-dev/astroid/commit/dd491d09cd57cdf2f62a6694c3b93c75dcfb184a", "https://github.com/pylint-dev/astroid/comm...
2021-11-19T16:46:31
pylint-dev__astroid-1262
[ "1273" ]
python
diff --git a/ChangeLog b/ChangeLog index 3b026ba905..9641cf0441 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,9 @@ Release date: TBA Closes #1260 +* Fix ``Module`` nodes not having a ``col_offset``, ``end_lineno``, and ``end_col_offset`` + attributes. + * Fix typing and update explanation for ``Arguments...
``nodes.Module`` don't have a ``end_lineno`` and ``end_col_offset`` ### Steps to reproduce ```python import astroid code = """ print("a module") """ module = astroid.parse(code) print(module.end_lineno) print(module.end_col_offset) ``` ### Current behavior `AttributeError` on both of the la...
1262
pylint-dev/astroid
diff --git a/tests/unittest_nodes_lineno.py b/tests/unittest_nodes_lineno.py index 75d664dc48..73cf0207cc 100644 --- a/tests/unittest_nodes_lineno.py +++ b/tests/unittest_nodes_lineno.py @@ -2,6 +2,7 @@ import pytest +import astroid from astroid import builder, nodes from astroid.const import PY38_PLUS, PY39_PLU...
none
[ "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_module" ]
[ "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_container", "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_name", "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_attribute", "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 5, "lines": 11 }
#1276 is actually working on this, but we ran into issues with the different `ast` parsers on different versions and implementations of Python. Note that the line numbers are not correct on some versions which is why the PR stalled a bit. Are you on a version lower than python 3.8 @tristanlatr ? I'm trying to write ...
56f5f055e4847e9fc2b74162ccad8f2a11db3bfc
[ "https://github.com/pylint-dev/astroid/commit/06c6cb3490b9b2a9bded08f901842b099d746975", "https://github.com/pylint-dev/astroid/commit/1183453b22f0c915ae9f6c2dffffa68a096bf5b9", "https://github.com/pylint-dev/astroid/commit/0b6c2556e57667783cc336a1b239fe2b243b6c18", "https://github.com/pylint-dev/astroid/comm...
2021-11-26T13:53:07
pylint-dev__astroid-1276
[ "1340" ]
python
diff --git a/ChangeLog b/ChangeLog index 670628b8da..ea4c1e3319 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ What's New in astroid 2.11.0? ============================= Release date: TBA +* Add new (optional) ``doc_node`` attribute to ``nodes.Module``, ``nodes.ClassDef``, + and ``nodes.FunctionDef``. ...
Impossible to get correct line number for the docstrings # Current behavior: Removing the first `ast.Expr` from the tree to populate `.doc` property makes it impossible to get correct line number for the docstirng. We ca start a module docstring at the line 3: ``` #!/usr/bin/env python3 """module docstri...
1276
pylint-dev/astroid
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 1ac896fc02..a7735c5c6e 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -1596,23 +1596,32 @@ class SomeClass: def test_get_doc() -> None: - node = astroid.extract_node( - """ + code = textwrap.dedent( + ""...
none
[ "tests/unittest_nodes.py::test_get_doc", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_comment_before_docstring", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_multiline_docstring", "tests/unittest_scoped_nodes.py::ModuleNodeTest::test_singleline_docstring", "tests/unittest_scoped_nodes.py::...
[ "tests/unittest_nodes.py::AsStringTest::test_3k_annotations_and_metaclass", "tests/unittest_nodes.py::AsStringTest::test_3k_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string", "tests/unittest_nodes.py::AsStringTest::test_as_string_for_list_containing_uninferable", "tests/unittest_nodes.py::...
[ "pytest -rA tests/" ]
pytest
{ "files": 4, "hunks": 31, "lines": 130 }
Thanks! Going to add `KeyError` to the caught exceptions. Btw, this does sound like we could base a `pylint` checker on this? If `str.format()` returns `Uninferable` it's likely that something is wrong? I don't think so, because this example from the pylint primer is fine, right? It's unpacking something dynamic, but I...
aa5a0d92e640ee5f3fa9a8ba3ba058a7b594ca44
[ "https://github.com/pylint-dev/astroid/commit/3876869109a10198d39317d931b48deddd7dc497" ]
2022-06-11T10:33:20
pylint-dev__astroid-1614
[ "1613" ]
python
diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py index 68445e731c..00253f243b 100644 --- a/astroid/brain/brain_builtin_inference.py +++ b/astroid/brain/brain_builtin_inference.py @@ -946,7 +946,7 @@ def _infer_str_format_call( try: formatted_string = forma...
Crash when inferring `str.format` call involving unpacking kwargs When parsing the following file: <!-- If sharing the code is not an option, please state so, but providing only the stacktrace would still be helpful. --> ```python class A: def render(self, audit_log_entry: AuditLogEntry): ret...
1614
pylint-dev/astroid
diff --git a/tests/unittest_brain_builtin.py b/tests/unittest_brain_builtin.py index a659c4fdf2..54e7d2190d 100644 --- a/tests/unittest_brain_builtin.py +++ b/tests/unittest_brain_builtin.py @@ -93,6 +93,9 @@ def test_string_format(self, format_string: str) -> None: "My name is {}, I'm {}".format(Unknown, ...
none
[ "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format_uninferable[\\n" ]
[ "tests/unittest_brain_builtin.py::BuiltinsTest::test_infer_property", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[empty-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_format[numbered-indexes]", "tests/unittest_brain_builtin.py::TestStringNodes::test_string_...
[ "pytest -rA tests/" ]
pytest
{ "files": 1, "hunks": 1, "lines": 2 }
@cdce8p Just thinking out loud: can we also use a type guard to define `cached_property`? Would `mypy` pick up on that? > @cdce8p Just thinking out loud: can we also use a type guard to define `cached_property`? Would `mypy` pick up on that? Not completely sure what you want to do with that. On other thing, I ju...
da745538c7236028a22cdf0405f6829fcf6886bc
[ "https://github.com/pylint-dev/astroid/commit/43e3dde23b5a8a985d7a4fe54c33c835768cee9c", "https://github.com/pylint-dev/astroid/commit/d0167fd7b1c7da8a8160f301fe90d5e91a66178e", "https://github.com/pylint-dev/astroid/commit/7c4c4951de3f188dcf2a0e677a1f65ae77aa0e50", "https://github.com/pylint-dev/astroid/comm...
2022-03-01T18:24:29
@cdce8p Just thinking out loud: can we also use a type guard to define `cached_property`? Would `mypy` pick up on that? > @cdce8p Just thinking out loud: can we also use a type guard to define `cached_property`? Would `mypy` pick up on that? Not completely sure what you want to do with that. On other thing, I ju...
pylint-dev__astroid-1417
[ "1410" ]
python
diff --git a/ChangeLog b/ChangeLog index e5be140ade..ec61695daf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,11 @@ Release date: TBA * Add new (optional) ``doc_node`` attribute to ``nodes.Module``, ``nodes.ClassDef``, and ``nodes.FunctionDef``. +* Replace custom ``cachedproperty`` with ``functools.cached_pro...
Replace `cachedproperty` with `functools.cached_property` (>= 3.8) I thought about this PR recently again. Typing `cachedproperty` might not work, but it can be replaced with `functools.cached_property`. We only need to `sys` guard it for `< 3.8`. This should work ```py if sys.version_info >= (3, 8): from functo...
1417
pylint-dev/astroid
diff --git a/tests/unittest_decorators.py b/tests/unittest_decorators.py index 4672f870a6..0700f570de 100644 --- a/tests/unittest_decorators.py +++ b/tests/unittest_decorators.py @@ -1,7 +1,8 @@ import pytest from _pytest.recwarn import WarningsRecorder -from astroid.decorators import deprecate_default_argument_val...
none
[ "tests/unittest_decorators.py::test_deprecation_warning_on_cachedproperty" ]
[ "tests/unittest_decorators.py::TestDeprecationDecorators::test_deprecated_default_argument_values_one_arg", "tests/unittest_decorators.py::TestDeprecationDecorators::test_deprecated_default_argument_values_two_args", "tests/unittest_decorators.py::TestDeprecationDecorators::test_deprecated_default_argument_valu...
[ ". venv/bin/activate && pytest -rA tests/" ]
pytest
{ "files": 7, "hunks": 30, "lines": 90 }
abf9d0e4e63d1098436602804548d07a0909ece1
[ "https://github.com/pylint-dev/astroid/commit/7d044a4fa2c1ae509164d0e318136089be36aabf", "https://github.com/pylint-dev/astroid/commit/225039dd8e4036afeb7db7e918e6f82d121bcfd4", "https://github.com/pylint-dev/astroid/commit/f9c2900c4e2d4c0b0032ea8c42878afcaa2c19e6", "https://github.com/pylint-dev/astroid/comm...
2021-01-24T11:26:24
pylint-dev__astroid-885
[ "855" ]
python
diff --git a/ChangeLog b/ChangeLog index 02852c6978..9ff42a6e77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,14 +2,18 @@ astroid's ChangeLog =================== +What's New in astroid 2.5.0? +============================ +Release Date: TBA + +* Enrich the ``brain_collection`` module so that ``__class_getitem__`` me...
deque misses __class_getitem__ In `brain_collections.py`, deque misses its `__class_getitem__`, implemented in Python 3.9. Should it be added with a test version, so astroid "knows" that it's not present in Python 3.8 but is in Python 3.9? Related to: https://github.com/PyCQA/pylint/issues/3951
885
pylint-dev/astroid
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index e6ff69289a..1c004a06cf 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -141,6 +141,17 @@ def test_deque_py35methods(self): self.assertIn("insert", inferred.locals) self.assertIn("index", inferred.locals) + ...
none
[ "tests/unittest_brain.py::CollectionsDequeTests::test_deque_py39methods" ]
[ "tests/unittest_brain.py::HashlibTest::test_hashlib", "tests/unittest_brain.py::HashlibTest::test_hashlib_py36", "tests/unittest_brain.py::CollectionsDequeTests::test_deque", "tests/unittest_brain.py::CollectionsDequeTests::test_deque_py35methods", "tests/unittest_brain.py::OrderedDictTest::test_ordered_dic...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 4, "lines": 18 }
This is caused by our local plugin. Has probably nothing to do with upstream. This is caused by a bad refactor from us, we deprecated `astroid.node_classes` and `astroid.scoped_nodes` in favor of `astroid.nodes` but nothing should break before astroid 3.0. @Pierre-Sassoulas I see. Also Statement is not available i...
40ea1a3b8e52bbfed43deb1725cde461f4bd8a96
[ "https://github.com/pylint-dev/astroid/commit/83064a191c949e535f7a22e950be215a240c5b30", "https://github.com/pylint-dev/astroid/commit/502536f6e654907eb00c1d28d58200bb666c1c2d" ]
2021-09-04T15:03:02
This is caused by our local plugin. Has probably nothing to do with upstream. This is caused by a bad refactor from us, we deprecated `astroid.node_classes` and `astroid.scoped_nodes` in favor of `astroid.nodes` but nothing should break before astroid 3.0. @Pierre-Sassoulas I see. Also Statement is not available i...
pylint-dev__astroid-1164
[ "1162" ]
python
diff --git a/astroid/nodes/__init__.py b/astroid/nodes/__init__.py index 06bf60d77d..26254a0d06 100644 --- a/astroid/nodes/__init__.py +++ b/astroid/nodes/__init__.py @@ -89,6 +89,7 @@ Set, Slice, Starred, + Statement, Subscript, TryExcept, TryFinally, @@ -116,6 +117,7 @@ SetComp, ...
ImportError: cannot import name 'Statement' from 'astroid.node_classes' ### Steps to reproduce 1. run pylint <some_file> ### Current behavior ```python exception: Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_glob...
1164
pylint-dev/astroid
diff --git a/tests/unittest_brain_ctypes.py b/tests/unittest_brain_ctypes.py index eecc981396..87d648bdc6 100644 --- a/tests/unittest_brain_ctypes.py +++ b/tests/unittest_brain_ctypes.py @@ -2,8 +2,7 @@ import pytest -from astroid import extract_node -from astroid.nodes.node_classes import Const +from astroid impo...
none
[ "tests/unittest_scoped_nodes.py::ClassNodeTest::test_metaclass_lookup" ]
[ "tests/unittest_brain_ctypes.py::test_ctypes_redefined_types_members[c_bool-bool-?]", "tests/unittest_brain_ctypes.py::test_ctypes_redefined_types_members[c_byte-int-b]", "tests/unittest_brain_ctypes.py::test_ctypes_redefined_types_members[c_char-bytes-c]", "tests/unittest_brain_ctypes.py::test_ctypes_redefin...
[ "pytest tests/ -rA" ]
pytest
{ "files": 1, "hunks": 4, "lines": 4 }
Actually, it seems a decorator is a red herring here, because I get the same off by one issue simply parsing a call ```python source = """\ f(a=2, b=3, ) """ [call] = ast.parse(source).body print("ast", call.lineno, call.end_lineno) [call] = astroid.parse(source).body print("astroid", call.fromlineno...
cfd9e74f7b4cbac08357cadec03c736501368afa
[ "https://github.com/pylint-dev/astroid/commit/b1e0db2ab2b81e303fdccbef44280b42747334e7", "https://github.com/pylint-dev/astroid/commit/15a5bf0ee51b3707e79a42b6427ae6abc80ccf89", "https://github.com/pylint-dev/astroid/commit/adbc4d48941967078a6100ad63953d5af9da2fa0", "https://github.com/pylint-dev/astroid/comm...
2022-01-14T21:14:48
pylint-dev__astroid-1351
[ "1350" ]
python
diff --git a/ChangeLog b/ChangeLog index bce6094b46..e206228968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,11 @@ Release date: TBA Closes #1330 +* Use the ``end_lineno`` attribute for the ``NodeNG.tolineno`` property + when it is available. + + Closes #1350 + * Add ``is_dataclass`` attribute to ``Cla...
Decorator.toline is off by 1 ### Steps to reproduce I came across this inconsistency while debugging why pylint reports `missing-docstring` on the wrong line for the `g2` function in the example. As it turns out, the `toline` of the decorator seems to point to `b=3,` instead of `)`. ```python import ast import ...
1351
pylint-dev/astroid
diff --git a/tests/unittest_builder.py b/tests/unittest_builder.py index eb7fbdc77f..fbcf413174 100644 --- a/tests/unittest_builder.py +++ b/tests/unittest_builder.py @@ -71,11 +71,14 @@ def test_callfunc_lineno(self) -> None: strarg = callfunc.args[0] self.assertIsInstance(strarg, nodes.Const) ...
none
[ "tests/unittest_builder.py::FromToLineNoTest::test_callfunc_lineno", "tests/unittest_nodes_lineno.py::TestLinenoColOffset::test_end_lineno_try", "tests/unittest_scoped_nodes.py::ClassNodeTest::test_function_with_decorator_lineno" ]
[ "tests/unittest_builder.py::FromToLineNoTest::test_class_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_decorated_function_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_for_while_lineno", "tests/unittest_builder.py::FromToLineNoTest::test_if_lineno", "tests/unittest_builder.py::Fr...
[ ". venv/bin/activate && pytest -rA tests" ]
pytest
{ "files": 3, "hunks": 3, "lines": 21 }
How can I learn as begineer Hi @Keuricloud8866, what do you want to learn ? In order to fix this ticket you should track the place where setuptools and distutils are used in pylint and find an alternative. For finding alternative we'll probably have to discuss how to do what we were doing before without setuptools. I a...
fb31eede489b45498e65b1921b537f7bd2dd8c9b
[ "https://github.com/pylint-dev/astroid/commit/22bca184df3d2fbbfa2f32eab89fbb9ef076d97d", "https://github.com/pylint-dev/astroid/commit/f53159ea09fc7c7106f4ca321d2ddeaf66938693", "https://github.com/pylint-dev/astroid/commit/0c536f1a513f4e6666aef17fc1f69192c37e2bf7", "https://github.com/pylint-dev/astroid/comm...
2022-05-01T14:27:44
How can I learn as begineer Hi @Keuricloud8866, what do you want to learn ? In order to fix this ticket you should track the place where setuptools and distutils are used in pylint and find an alternative. For finding alternative we'll probably have to discuss how to do what we were doing before without setuptools. I a...
pylint-dev__astroid-1536
[ "1103", "1320" ]
python
diff --git a/ChangeLog b/ChangeLog index bd6ed51cda..06a7163ff6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,10 @@ Release date: TBA Closes #1512 +* Remove dependency on ``pkg_resources`` from ``setuptools``. + + Closes #1103 + * Allowed ``AstroidManager.clear_cache`` to reload necessary brain plugins. ...
Remove dependency to ``setuptools`` and ``distutil`` As see in #1030 and #1100 there is a hidden dependency to setuptools (and probably distutils too), we made it explicit in #1100 but the better thing to do would be to remove it entirely if possible. Decrease the time required to import astroid ### Steps to reprodu...
1536
pylint-dev/astroid
diff --git a/tests/unittest_manager.py b/tests/unittest_manager.py index cd63950ea2..6c105a12bb 100644 --- a/tests/unittest_manager.py +++ b/tests/unittest_manager.py @@ -10,12 +10,11 @@ from collections.abc import Iterator from contextlib import contextmanager -import pkg_resources - import astroid from astroid ...
none
[ "tests/unittest_manager.py::AstroidManagerTest::test_namespace_package_pth_support", "tests/unittest_manager.py::AstroidManagerTest::test_nested_namespace_import", "tests/unittest_manager.py::ClearCacheTest::test_clear_cache_clears_other_lru_caches" ]
[ "tests/unittest_manager.py::AstroidManagerTest::test_ast_from_class", "tests/unittest_manager.py::AstroidManagerTest::test_ast_from_class_attr_error", "tests/unittest_manager.py::AstroidManagerTest::test_ast_from_class_with_module", "tests/unittest_manager.py::AstroidManagerTest::test_ast_from_file", "tests...
[ "pytest -rA tests/" ]
pytest
{ "files": 5, "hunks": 9, "lines": 59 }
I can't seem to reproduce this in my `virtualenv`. This might be specific to `venv`? Needs some further investigation. @interifter Which version of `pylint` are you using? Right, ``pip install pylint astroid==2.9.0``, will keep the local version if you already have one, so I thought it was ``2.12.2`` but that could be ...
d2a5b3c7b1e203fec3c7ca73c30eb1785d3d4d0a
[ "https://github.com/pylint-dev/astroid/commit/3661e1264643a27293e31cd6760ade8dc7b6d920", "https://github.com/pylint-dev/astroid/commit/b19b115d4549569700c395500653ff83cc894f88" ]
2022-01-08T19:36:45
I can't seem to reproduce this in my `virtualenv`. This might be specific to `venv`? Needs some further investigation. @interifter Which version of `pylint` are you using? Right, ``pip install pylint astroid==2.9.0``, will keep the local version if you already have one, so I thought it was ``2.12.2`` but that could be ...
pylint-dev__astroid-1333
[ "1327" ]
python
diff --git a/ChangeLog b/ChangeLog index 6c56d234f9..783391c360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,14 @@ What's New in astroid 2.10.0? Release date: TBA +What's New in astroid 2.9.3? +============================ +Release date: TBA + +* Fixed regression where packages without a ``__init__.py`` file ...
astroid 2.9.1 breaks pylint with missing __init__.py: F0010: error while code parsing: Unable to load file __init__.py ### Steps to reproduce > Steps provided are for Windows 11, but initial problem found in Ubuntu 20.04 > Update 2022-01-04: Corrected repro steps and added more environment details 1. Set up simp...
1333
pylint-dev/astroid
diff --git a/tests/unittest_modutils.py b/tests/unittest_modutils.py index d6fcb68e25..01d5e5b91e 100644 --- a/tests/unittest_modutils.py +++ b/tests/unittest_modutils.py @@ -30,6 +30,7 @@ import tempfile import unittest import xml +from pathlib import Path from xml import etree from xml.etree import ElementTree ...
none
[ "tests/unittest_modutils.py::ModPathFromFileTest::test_load_packages_without_init" ]
[ "tests/unittest_modutils.py::ModuleFileTest::test_find_egg_module", "tests/unittest_modutils.py::ModuleFileTest::test_find_zipped_module", "tests/unittest_modutils.py::LoadModuleFromNameTest::test_known_values_load_module_from_name_1", "tests/unittest_modutils.py::LoadModuleFromNameTest::test_known_values_loa...
[ "pytest -rA tests" ]
pytest
{ "files": 2, "hunks": 3, "lines": 16 }
@cdce8p thanks for pointing this out. I'm on it, hope to get up a PR soon.
02a4c266534fb473da07ea5b905726281d06cbde
[ "https://github.com/pylint-dev/astroid/commit/c6150a4f080bbf6c0cdc3891b9c46cda75340ced", "https://github.com/pylint-dev/astroid/commit/cf5e941983a62a9c87e1081658f38adc29c60a69" ]
2021-08-16T14:36:35
pylint-dev__astroid-1130
[ "1129" ]
python
diff --git a/ChangeLog b/ChangeLog index f0cc1df31e..615941fb66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,8 +12,13 @@ What's New in astroid 2.7.1? ============================ Release date: TBA +* When processing dataclass attributes, only do typing inference on collection types. + Support for instantiating ot...
Regression with dataclass inference ### Steps to reproduce ```py from dataclasses import dataclass from typing import Any, Callable @dataclass class A: enabled: Callable[[Any], bool] instance = A(lambda x: x == 42) instance.enabled(2) # not-callable ``` ### Current behavior ``` ************* ...
1130
pylint-dev/astroid
diff --git a/tests/unittest_brain_dataclasses.py b/tests/unittest_brain_dataclasses.py index f7b08747f0..f90893d5cd 100644 --- a/tests/unittest_brain_dataclasses.py +++ b/tests/unittest_brain_dataclasses.py @@ -4,6 +4,7 @@ from astroid import bases, nodes from astroid.const import PY37_PLUS from astroid.exceptions i...
none
[ "tests/unittest_brain_dataclasses.py::test_inference_callable_attribute" ]
[ "tests/unittest_brain_dataclasses.py::test_inference_attribute_no_default", "tests/unittest_brain_dataclasses.py::test_inference_non_field_default", "tests/unittest_brain_dataclasses.py::test_inference_field_default", "tests/unittest_brain_dataclasses.py::test_inference_field_default_factory", "tests/unitte...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 3, "lines": 54 }
39c2a9805970ca57093d32bbaf0e6a63e05041d8
[ "https://github.com/pylint-dev/astroid/commit/a4b1d5b529aa73f681a8ae5eb77a8f79c534e68b", "https://github.com/pylint-dev/astroid/commit/5ab5949077261fef86591690dd617b9bb1d7772f", "https://github.com/pylint-dev/astroid/commit/c9cc6a67c05bd74da63b813f7fa01dc757d18193", "https://github.com/pylint-dev/astroid/comm...
2021-10-03T15:58:07
pylint-dev__astroid-1196
[ "1195" ]
python
diff --git a/ChangeLog b/ChangeLog index c3b3e6b90b..24a7d49bfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,10 @@ Release date: TBA * Fix test for Python ``3.11``. In some instances ``err.__traceback__`` will be uninferable now. +* Infer the ``DictUnpack`` value for ``Dict.getitem`` calls. + + Closes #11...
getitem does not infer the actual unpacked value When trying to call `Dict.getitem()` on a context where we have a dict unpacking of anything beside a real dict, astroid currently raises an `AttributeError: 'getitem'`, which has 2 problems: - The object might be a reference against something constant, this pattern i...
1196
pylint-dev/astroid
diff --git a/tests/unittest_python3.py b/tests/unittest_python3.py index 9f60833e8e..bf0a0b33da 100644 --- a/tests/unittest_python3.py +++ b/tests/unittest_python3.py @@ -5,7 +5,9 @@ import unittest from textwrap import dedent -from astroid import nodes +import pytest + +from astroid import exceptions, nodes from ...
none
[ "tests/unittest_python3.py::Python3TC::test_unpacking_in_dict_getitem_uninferable", "tests/unittest_python3.py::Python3TC::test_unpacking_in_dict_getitem_with_ref" ]
[ "tests/unittest_python3.py::Python3TC::test_annotation_as_string", "tests/unittest_python3.py::Python3TC::test_annotation_support", "tests/unittest_python3.py::Python3TC::test_as_string", "tests/unittest_python3.py::Python3TC::test_async_comprehensions", "tests/unittest_python3.py::Python3TC::test_async_com...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 2, "lines": 19 }
4cfd9b6d1003b9912ab94538e1dfa5d734f55251
[ "https://github.com/pylint-dev/astroid/commit/c18286e1d7eef287297441ec020347f3f15780fb", "https://github.com/pylint-dev/astroid/commit/fa3731ba6992abaf6cf256fcf85381053799e484" ]
2021-04-07T23:44:25
pylint-dev__astroid-934
[ "904" ]
python
diff --git a/ChangeLog b/ChangeLog index 6097526bbd..c606b76106 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,10 @@ Release Date: TBA Closes #922 +* Fix inference of attributes defined in a base class that is an inner class + + Closes #904 + What's New in astroid 2.5.6? ============================ di...
error during inference of class inheriting from another with `mod.Type` format Consider package a `level` with a class `Model` defined in `level`'s `__init__.py` file. ``` class Model: data: int = 1 ``` If a class `Test` inherits from `Model` as `class Test(Model)`, and `Model` comes from `from level impor...
934
pylint-dev/astroid
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 7fb1ed55c9..6b9f4c0609 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -3894,6 +3894,65 @@ class Clazz(metaclass=_Meta): ).inferred()[0] assert isinstance(cls, nodes.ClassDef) and cls.name == "Cl...
none
[ "tests/unittest_inference.py::InferenceTest::test_infer_subclass_attr_inner_class" ]
[ "tests/unittest_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/unittest_inference.py::InferenceTest::test__new__", "tests/unittest_inference.py::InferenceTest::test__new__bound_methods", "tests/unittest_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/unittest_in...
[ "pytest -rA tests -m \"not acceptance\"" ]
pytest
{ "files": 2, "hunks": 3, "lines": 7 }
@gpshead thanks for the report.
efc5be48e8294cea6c5335a3ad0821fa920fd1e6
[ "https://github.com/pylint-dev/astroid/commit/9d4082a518198037f5ac564ea4c111584d4d648f", "https://github.com/pylint-dev/astroid/commit/0cbce24ba586144114e9f51c1242523c3362a2f9", "https://github.com/pylint-dev/astroid/commit/dffd1bfbdeb19be77a9d2f08a2fa7d76f206d39a" ]
2021-05-16T07:13:50
@gpshead thanks for the report.
pylint-dev__astroid-993
[ "922" ]
python
diff --git a/ChangeLog b/ChangeLog index 9d7b945fde..6097526bbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,10 @@ Release Date: TBA Closes PyCQA/pylint#3535 Closes PyCQA/pylint#4358 +* Update random brain to fix a crash with inference of some sequence elements + + Closes #922 + What's New in astroid...
__init__() got an unexpected keyword argument 'lineno' from brain_random.py ### Steps to reproduce & current behavior ``` ~/tempenv$ pylint --version pylint 2.7.2 astroid 2.5.1 Python 3.8.7 (default, Dec 22 2020, 10:37:26) [GCC 10.2.0] (tempenv) ~/tempenv$ cat example.py class A: pass b = sample(list({1...
993
pylint-dev/astroid
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index 0e8c591198..26fad2e3bf 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -1858,6 +1858,18 @@ def test_inferred_successfully(self): elems = sorted(elem.value for elem in inferred.elts) self.assertEqual(elems, [1, 2...
none
[ "tests/unittest_brain.py::RandomSampleTest::test_no_crash_on_evaluatedobject" ]
[ "tests/unittest_brain.py::HashlibTest::test_hashlib", "tests/unittest_brain.py::HashlibTest::test_hashlib_py36", "tests/unittest_brain.py::CollectionsDequeTests::test_deque", "tests/unittest_brain.py::CollectionsDequeTests::test_deque_py35methods", "tests/unittest_brain.py::CollectionsDequeTests::test_deque...
[ "pytest -rA tests/" ]
pytest
{ "files": 2, "hunks": 2, "lines": 6 }
This seems relevant: https://github.com/PyCQA/astroid/blob/1a698acd4ca746851e6a525bf7e012ac6e6eb877/astroid/nodes/scoped_nodes/scoped_nodes.py#L1702-L1712 I am not familiar with that code, but it seems like this is indeed very error-prone. @DanielNoord https://github.com/PyCQA/astroid/blob/1a698acd4ca746851e6...
495581f0ff1b0513397b9177c62f27e702e11bb2
[ "https://github.com/pylint-dev/astroid/commit/4b31a4bdbde019bf26fa7751172d5541530d2982", "https://github.com/pylint-dev/astroid/commit/15722e60a1180d1d766d8daa6711b87fafbc0674", "https://github.com/pylint-dev/astroid/commit/65b09d5d9242277ec55df957eeaca6112de783ac" ]
2023-04-15T14:52:11
This seems relevant: https://github.com/PyCQA/astroid/blob/1a698acd4ca746851e6a525bf7e012ac6e6eb877/astroid/nodes/scoped_nodes/scoped_nodes.py#L1702-L1712 I am not familiar with that code, but it seems like this is indeed very error-prone. @DanielNoord https://github.com/PyCQA/astroid/blob/1a698acd4ca746851e6...
pylint-dev__astroid-2118
[ "1735" ]
python
diff --git a/ChangeLog b/ChangeLog index 460ef30507..f02a58516c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,9 @@ What's New in astroid 2.15.3? ============================= Release date: TBA +* Fix ``infer_call_result()`` crash on methods called ``with_metaclass()``. + + Closes #1735 What's New in ast...
Code for supporting `with_metaclass` seems broken So this code works as expected: ```python node = astroid.extract_node(''' def foo(): return 42 ''') print(list(node.infer_call_result(caller=node))) ``` ```console $ python a.py [<Const.int l.3 at 0x105704070>] ``` But this breaks: ```python node = a...
2118
pylint-dev/astroid
diff --git a/tests/test_inference.py b/tests/test_inference.py index 37a48f089d..7fcbb10cce 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -4055,6 +4055,11 @@ class C: inferred = next(node.infer()) self.assertRaises(InferenceError, next, inferred.infer_call_result(node))...
none
[ "tests/test_inference.py::InferenceTest::test_infer_call_result_with_metaclass" ]
[ "tests/test_inference.py::InferenceUtilsTest::test_path_wrapper", "tests/test_inference.py::InferenceTest::test__new__", "tests/test_inference.py::InferenceTest::test__new__bound_methods", "tests/test_inference.py::InferenceTest::test_advanced_tupleassign_name_inference1", "tests/test_inference.py::Inferenc...
[ ". venv/bin/activate && pytest -rA" ]
pytest
{ "files": 2, "hunks": 2, "lines": 13 }