Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →astroid issue #3077 reports different inference results for two ways of reaching callable behavior. The proposed change in pull request #3242 aims to let both paths proceed consistently, but the PR was still open and contested in review in the status reported here. It should not be described as a merged or released fix.
What inference discrepancy was reported?
The issue is phrased as: “Bug: identical typing.cast expressions yield different inferences depending on how they are reached.” In the reproducer described by the PR author, an implicit call, self.separator(), and an explicit method call, self.separator.run(), have structurally similar implementations and are runtime-equivalent in that example. Yet astroid follows different inference routes, and pylint reports an inconsistent no-member result.
As an Amazon Associate I earn from qualifying purchases.
Those reproduction details are the author’s account, not an independently confirmed run. The distinction matters: the report describes what happened for a particular example, not a general guarantee that these forms always behave identically.
Free tools Windows power users keep installed
One-click scans. No signup required.
Where does the author locate the divergence?
The author traces the implicit call through BaseInstance.infer_call_result. That route includes an early, optional lookup using the call’s attribute name against the inferred instance. In the reported case, the lookup raises InferenceError; because it happens before the later __call__ inference path, the generator ends without reaching that path.
#1 Best Overall
The explicit self.separator.run() form instead follows a bound-method inference route. The two expressions therefore do not reach the same inference logic, even though the author says their example gives them equivalent runtime behavior.
What does pull request #3242 propose?
The proposed patch catches InferenceError around the optional early lookup in BaseInstance.infer_call_result. If that lookup fails, inference can continue to the later __call__ path rather than ending at the lookup.
The PR also adds a regression test named test_infer_call_result_dunder_call_consistent_with_attribute_call in tests/test_inference.py. The author says they ran the test suite; that result is self-reported and was not independently reproduced here. The intended outcome is more consistent handling of the two routes, not proof that the inferred result is maximally precise.
Why is the proposed exception handling disputed?
Reviewer DanielNoord objected to catching the exception broadly: “This does not seem correct. An inference error should not be swallowed.” The concern is that ignoring an InferenceError from the optional lookup might conceal a different, legitimate inference failure instead of only allowing the intended fallback.
Rank #3
The author acknowledged that a broad catch could hide other errors and asked whether a narrower or different approach would be preferable. That is a substantive design question: the patch’s fallback may address the reported case, but the review asks whether it preserves meaningful error signals in other cases.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What is the upstream status, and what should readers conclude?
In the status reported for this article, PR #3242 was open, and issue #3077 appeared open. The review exchange shows the proposed behavior was still under discussion, so the patch cannot be presented as accepted, merged, or released.
Rank #4
Consistency and correctness are separate goals. Making implicit-call and explicit-method-call inference return the same result would remove a discrepancy, but agreement alone would not show that the shared inferred type is correct. The repository describes astroid as a Python source representation library used by pylint and other projects; the issue concerns how its inference behavior feeds tools such as pylint, not a change to Python runtime call semantics.
For project context, see the astroid repository. The detailed reproduction and diagnosis come from the author’s account, while the proposed fix and its review are documented in the pull request.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




