From 7ad156bde771374ea9ae6911246952f166b46a77 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 28 Apr 2013 21:19:05 +0430 Subject: [PATCH] fixed a problem with 'None' returns --- jedi/fast_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jedi/fast_parser.py b/jedi/fast_parser.py index 618f4a33..16e86d2e 100644 --- a/jedi/fast_parser.py +++ b/jedi/fast_parser.py @@ -136,7 +136,7 @@ class ParserNode(object): el = module.imports[0] except IndexError: try: - el = module.returns[0] + el = [r for r in module.returns if r is not None][0] except IndexError: return self.parent.indent + 1 return el.start_pos[1] @@ -149,6 +149,8 @@ class ParserNode(object): items = getattr(parser.module, c) if set_parent: for i in items: + if i is None: + continue # happens with empty returns i.parent = scope.use_as_parent if isinstance(i, (pr.Function, pr.Class)): for d in i.decorators: