diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index 1a54501f..a74056ec 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -20,7 +20,8 @@ class CompiledValue(ContextWrapper): self._compiled_obj = compiled_obj def __getattribute__(self, name): - if name in ('get_safe_value', 'execute_operation', 'access_handle'): + if name in ('get_safe_value', 'execute_operation', 'access_handle', + 'negate'): return getattr(self._compiled_obj, name) return super(CompiledValue, self).__getattribute__(name) @@ -33,7 +34,7 @@ def create_simple_object(evaluator, obj): Only allows creations of objects that are easily picklable across Python versions. """ - assert type(obj) in (int, float, str, bytes, unicode, slice, complex) + assert type(obj) in (int, float, str, bytes, unicode, slice, complex, bool), obj compiled_obj = create_from_access_path( evaluator, evaluator.compiled_subprocess.create_simple_object(obj) diff --git a/jedi/evaluate/context/iterable.py b/jedi/evaluate/context/iterable.py index f7698f0b..d59f2e3f 100644 --- a/jedi/evaluate/context/iterable.py +++ b/jedi/evaluate/context/iterable.py @@ -295,9 +295,13 @@ class SequenceLiteralContext(Sequence): compiled_obj_index = compiled.create_simple_object(self.evaluator, index) for key, value in self.get_tree_entries(): for k in self._defining_context.eval_node(key): - if isinstance(k, compiled.CompiledObject) \ - and k.execute_operation(compiled_obj_index, u'==').get_safe_value(): - return self._defining_context.eval_node(value) + try: + method = k.execute_operation + except AttributeError: + pass + else: + if method(compiled_obj_index, u'==').get_safe_value(): + return self._defining_context.eval_node(value) raise SimpleGetItemNotFound('No key found in dictionary %s.' % self) if isinstance(index, slice):