forked from pylint-dev/astroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the way how context caching and scoping is done.
This patch reverts some changes added by a couple of changesets, making the context caching and scoping to work as before. The changesets in question are: * 41b3bd589da0549ac061bc4c4b5d379cdbb1e10c Replace copy_context with some dynamic scoping. * 8d3c601 Remove context.lookupname; make it an argument to infer() when appropriate. * partially reverts 048a42c. Fix some deep recursion problems. There were some problems with these changes, which led to horrendous performance when dealing with multiple inference paths of the same names, as seen in these Pylint issues: * https://bitbucket.org/logilab/pylint/issue/395/horrible-performance-related-to-inspect * https://bitbucket.org/logilab/pylint/issue/465/pylint-hangs-when-using-inspectsignature * https://bitbucket.org/logilab/pylint/issue/430/pylint-140-execution-time-and-memory The reverted changes assumed that a context it's only passed to callees and then destroyed, thus InferenceContext.push always returned another inference context, with the updated inference path so far. This is wrong, since contexts are sometimes reused, so the original context, the one before the .push call need to have the same cache key in its path (this is actually what's happening in these mentioned issues, the same object is inferred over and over again, but with different contexts).
- Loading branch information
1 parent
a557365
commit 3d342e8
Showing
7 changed files
with
143 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.