diff --git a/jedi/cache.py b/jedi/cache.py index 20805845..2b671700 100644 --- a/jedi/cache.py +++ b/jedi/cache.py @@ -21,6 +21,7 @@ from __future__ import with_statement import time import os import sys +import hashlib try: import cPickle as pickle except: @@ -312,7 +313,7 @@ class _ModulePickling(object): shutil.rmtree(self._cache_directory()) def _get_hashed_path(self, path): - return self._get_path('%s.pkl' % hash(path)) + return self._get_path('%s.pkl' % hashlib.md5(path.encode("utf-8")).hexdigest()) def _get_path(self, file): dir = self._cache_directory() diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 65210124..d1ea83ff 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -560,7 +560,7 @@ class Flow(Scope): @parent.setter def parent(self, value): self._parent = value - if self.next: + if hasattr(self, "next") and self.next: self.next.parent = value def get_code(self, first_indent=False, indention=' '):