-
-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve parent CallContext
when inferring nested functions
#1982
Conversation
CallContext
when inferring nested functions
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1982 +/- ##
==========================================
- Coverage 92.65% 92.64% -0.01%
==========================================
Files 94 94
Lines 10903 10891 -12
==========================================
- Hits 10102 10090 -12
Misses 801 801
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing code and fixing bug at the same time ! You're the bane of bad productivity metrics, Marc ;)
Thanks 😄 Took me literally the whole day yesterday for such an easy fix. I find the constant recursion in astroid quite difficult to debug but maybe that's just me. |
(cherry picked from commit a0d219c)
@Pierre-Sassoulas What do you think about the |
Wonderful fix @cdce8p! Glad to see you opening some PRs again 😄 |
Only for a short while, unfortunately. Will be quite busy the next month. |
I'm definitely going to release 2.13.4 tomorrow. |
This reverts commit a0d219c (pylint-dev#1982).
This reverts commit a0d219c (pylint-dev#1982).
…onError regression (pylint-dev#2000) This reverts commit a0d219c (pylint-dev#1982). (cherry picked from commit 72f5afb)
Description
Alternative to #1981
At the moment
infer_call
creates a newCallContext
for eachinfer_call_result
call overwriting the current one. Result was that nested functions with dynamic values couldn't be inferred.Instead of overwriting the
CallContext
, keep it inparent_call_context
so it can be reused later.With that nested functions can now be inferred. The custom inference tip for
typing.cast
is thus no longer necessary.https://github.com/PyCQA/astroid/blob/dfd88f5edc636df80c8cabd61a6b8d6bc8746ca9/astroid/inference.py#L274-L278
Closes pylint-dev/pylint#8074