Preserve parent CallContext when inferring nested functions#1982
Preserve parent CallContext when inferring nested functions#1982cdce8p merged 1 commit intopylint-dev:mainfrom
CallContext when inferring nested functions#1982Conversation
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.
|
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
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_callcreates a newCallContextfor eachinfer_call_resultcall 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_contextso it can be reused later.With that nested functions can now be inferred. The custom inference tip for
typing.castis thus no longer necessary.https://github.com/PyCQA/astroid/blob/dfd88f5edc636df80c8cabd61a6b8d6bc8746ca9/astroid/inference.py#L274-L278
Closes pylint-dev/pylint#8074