File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
astroid/nodes/scoped_nodes Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ What's New in astroid 3.2.3?
1616============================
1717Release date: TBA
1818
19+ * Fix ``AssertionError`` when inferring a property consisting of a partial function.
20+
21+ Closes pylint-dev/pylint#9214
22+
1923
2024What's New in astroid 3.2.2?
2125============================
Original file line number Diff line number Diff line change @@ -2518,6 +2518,10 @@ def igetattr(
25182518 elif isinstance (inferred , objects .Property ):
25192519 function = inferred .function
25202520 if not class_context :
2521+ if not context .callcontext :
2522+ context .callcontext = CallContext (
2523+ args = function .args .arguments , callee = function
2524+ )
25212525 # Through an instance so we can solve the property
25222526 yield from function .infer_call_result (
25232527 caller = self , context = context
Original file line number Diff line number Diff line change @@ -477,3 +477,22 @@ def test_recursion_during_inference(mocked) -> None:
477477 with pytest .raises (InferenceError ) as error :
478478 next (node .infer ())
479479 assert error .value .message .startswith ("RecursionError raised" )
480+
481+
482+ def test_regression_missing_callcontext () -> None :
483+ node : nodes .Attribute = _extract_single_node (
484+ textwrap .dedent (
485+ """
486+ import functools
487+
488+ class MockClass:
489+ def _get_option(self, option):
490+ return "mystr"
491+
492+ enabled = property(functools.partial(_get_option, option='myopt'))
493+
494+ MockClass().enabled
495+ """
496+ )
497+ )
498+ assert node .inferred ()[0 ].value == "mystr"
You can’t perform that action at this time.
0 commit comments