diff options
author | Arianna <self@areveny.com> | 2022-01-20 18:18:56 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 18:18:56 -0600 |
commit | 082b723109675da8929e71d12bf5677af4bfb18e (patch) | |
tree | e216a74773fb8de4dc699ef135c2e2cd564eba97 | |
parent | 3047277175e229a938a4dd83b0cde1015f473020 (diff) | |
download | astroid-git-revert-1366-postinit-property.tar.gz |
Revert "Fix builtin inference on property not including function arguments"revert-1366-postinit-property
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | astroid/brain/brain_builtin_inference.py | 4 | ||||
-rw-r--r-- | tests/unittest_brain_builtin.py | 22 |
3 files changed, 1 insertions, 27 deletions
@@ -6,8 +6,6 @@ What's New in astroid 2.10.0? ============================= Release date: TBA -* Fixed builtin inferenence on `property` calls not calling the `postinit` of the new node, which - resulted in instance arguments missing on these nodes. What's New in astroid 2.9.4? ============================ diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py index f5114617..0bf35260 100644 --- a/astroid/brain/brain_builtin_inference.py +++ b/astroid/brain/brain_builtin_inference.py @@ -566,7 +566,7 @@ def infer_property(node, context=None): if not isinstance(inferred, (nodes.FunctionDef, nodes.Lambda)): raise UseInferenceDefault - prop_func = objects.Property( + return objects.Property( function=inferred, name=inferred.name, doc=getattr(inferred, "doc", None), @@ -574,8 +574,6 @@ def infer_property(node, context=None): parent=node, col_offset=node.col_offset, ) - prop_func.postinit(body=[], args=inferred.args) - return prop_func def infer_bool(node, context=None): diff --git a/tests/unittest_brain_builtin.py b/tests/unittest_brain_builtin.py deleted file mode 100644 index e45b80f7..00000000 --- a/tests/unittest_brain_builtin.py +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html -# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE -"""Unit Tests for the builtins brain module.""" - -import unittest - -from astroid import extract_node, objects - - -class BuiltinsTest(unittest.TestCase): - def test_infer_property(self): - class_with_property = extract_node( - """ - class Something: - def getter(): - return 5 - asd = property(getter) #@ - """ - ) - inferred_property = list(class_with_property.value.infer())[0] - self.assertTrue(isinstance(inferred_property, objects.Property)) - self.assertTrue(hasattr(inferred_property, "args")) |