summaryrefslogtreecommitdiff
path: root/astroid/nodes.py
diff options
context:
space:
mode:
authorCalen Pennington <cale@edx.org>2017-03-08 10:21:25 -0500
committerClaudiu Popa <pcmanticore@gmail.com>2017-03-12 13:56:50 +0200
commit480e6d53210b4c160b4347cbb4987d92842a5c45 (patch)
tree50a8590d0cb0f710d195a5f589fc749c60b28324 /astroid/nodes.py
parent26d4c4de343ba74ae46838a7b4995dc180202652 (diff)
downloadastroid-git-480e6d53210b4c160b4347cbb4987d92842a5c45.tar.gz
Quickstart _infer_binary_operation to raise errors that occur during startup.
Since https://github.com/PyCQA/astroid/commit/3e27213914271309a4716662b09fda91fca9efa1, is_subtype and is_supertype raise exceptions when they can't find a relationship between types. This is caught by the callers of _infer_binary_operation. However, the error is only thrown after the generator return by _infer_binary_operation is started. Prior to this patch, the generator is only started inside the else clause of: try: results = _infer_binary_operation(lhs, rhs, self, context, _get_binop_flow) except exceptions._NonDeducibleTypeHierarchy: yield util.Uninferable else: for result in results: yield result To address this, the quickstart decorator pulls the first value from the generator when it's called, and then buffers that first result until it is needed by the later iteration.
Diffstat (limited to 'astroid/nodes.py')
0 files changed, 0 insertions, 0 deletions