From a998c36fa3a7537b2f7bb706b2baf67263fa182a Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 26 Feb 2015 14:40:33 +0100 Subject: [PATCH] Fix an attribute error in static analysis code. --- jedi/evaluate/compiled/__init__.py | 1 + test/static_analysis/attribute_error.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index 3ab487e9..962d3dbf 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -40,6 +40,7 @@ class CompiledObject(Base): # comply with the parser start_pos = 0, 0 path = None # modules have this attribute - set it to None. + used_names = {} # To be consistent with modules. def __init__(self, obj, parent=None): self.obj = obj diff --git a/test/static_analysis/attribute_error.py b/test/static_analysis/attribute_error.py index 7ceb9397..4b084c11 100644 --- a/test/static_analysis/attribute_error.py +++ b/test/static_analysis/attribute_error.py @@ -111,3 +111,9 @@ import import_tree import_tree.a import_tree.b + +# This is something that raised an error, because it was using a complex +# mixture of Jedi fakes and compiled objects. +import _sre +#! 15 attribute-error +_sre.compile().not_existing