From c58cdbbf9b78ff33d6f15b4ab6ae53728b22d1b4 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 2 Feb 2015 00:45:17 +0100 Subject: [PATCH] Fix an issue that comes from a combination of property/__slots__/pickle --- jedi/parser/fast.py | 15 +++++++++++++++ jedi/parser/tree.py | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/jedi/parser/fast.py b/jedi/parser/fast.py index 13a06e0f..a3aa522d 100644 --- a/jedi/parser/fast.py +++ b/jedi/parser/fast.py @@ -62,6 +62,21 @@ class FastModule(pr.SubModule): return "" % (type(self).__name__, self.name, self.start_pos[0], self.end_pos[0]) + # To avoid issues with with the `parser.Parser`, we need setters that do + # nothing, because if pickle comes along and sets those values. + @global_names.setter + def global_names(self, value): + pass + + @error_statement_stacks.setter + def error_statement_stacks(self, value): + pass + + @used_names.setter + def used_names(self, value): + pass + + class MergedNamesDict(object): def __init__(self, dicts): diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index 3120debf..9f21b66f 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -614,7 +614,7 @@ class SubModule(Scope, Module): of a module. """ __slots__ = ('path', 'global_names', 'used_names', '_name', - 'use_as_parent', 'error_statement_stacks') + 'error_statement_stacks') type = 'file_input' def __init__(self, children): @@ -628,7 +628,6 @@ class SubModule(Scope, Module): """ super(SubModule, self).__init__(children) self.path = None # Set later. - # this may be changed depending on fast_parser @property @cache.underscore_memoization