1
0
forked from VimPlug/jedi

Fixed caching issues

Fixed exception raised during cache reading

Switched cache hashing to hashlib

In python 3.3 the hash function is returning different hashes during
different executions of the application.
This commit is contained in:
Aldo Stracquadanio
2013-03-23 23:07:17 +00:00
parent de849fbe8a
commit be8ef33b69
2 changed files with 3 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ from __future__ import with_statement
import time import time
import os import os
import sys import sys
import hashlib
try: try:
import cPickle as pickle import cPickle as pickle
except: except:
@@ -312,7 +313,7 @@ class _ModulePickling(object):
shutil.rmtree(self._cache_directory()) shutil.rmtree(self._cache_directory())
def _get_hashed_path(self, path): 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): def _get_path(self, file):
dir = self._cache_directory() dir = self._cache_directory()

View File

@@ -560,7 +560,7 @@ class Flow(Scope):
@parent.setter @parent.setter
def parent(self, value): def parent(self, value):
self._parent = value self._parent = value
if self.next: if hasattr(self, "next") and self.next:
self.next.parent = value self.next.parent = value
def get_code(self, first_indent=False, indention=' '): def get_code(self, first_indent=False, indention=' '):