diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-30 08:29:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-30 08:29:02 -0400 |
commit | e970218f6f591264f2b0512f46609c78e257e0b7 (patch) | |
tree | 987bb5c4e731d508ead2428cc4ba1da890f7de4c | |
parent | da246398cb42c1c0509ce572cfb93b6bc1776c1a (diff) | |
download | astroid-git-e970218f6f591264f2b0512f46609c78e257e0b7.tar.gz |
Yield directly from _explicit_inference in NodeNG.infer() (#2157)
-rw-r--r-- | astroid/nodes/node_ng.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 52852bf9..de5dec77 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -136,11 +136,12 @@ class NodeNG: if self._explicit_inference is not None: # explicit_inference is not bound, give it self explicitly try: - # pylint: disable=not-callable - results = list(self._explicit_inference(self, context, **kwargs)) - if context is not None: - context.nodes_inferred += len(results) - yield from results + if context is None: + yield from self._explicit_inference(self, context, **kwargs) + return + for result in self._explicit_inference(self, context, **kwargs): + context.nodes_inferred += 1 + yield result return except UseInferenceDefault: pass |