From 85293286990822e5a1fea54d031b2d0dfe998a90 Mon Sep 17 00:00:00 2001 From: "Hoyt Koepke hoytak@gmail.com" Date: Mon, 16 Mar 2009 20:10:14 -0700 Subject: [PATCH] Made lexicon unpickling more robust; on error it regenerates it. --- Cython/Compiler/Scanning.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Scanning.py b/Cython/Compiler/Scanning.py index 9ef47dc1..6c2144fc 100644 --- a/Cython/Compiler/Scanning.py +++ b/Cython/Compiler/Scanning.py @@ -102,7 +102,12 @@ def try_to_unpickle_lexicon(): if notify_lexicon_unpickling: t0 = time() print("Unpickling lexicon...") - lexicon = pickle.load(f) + try: + lexicon = pickle.load(f) + except Exception, e: + print "WARNING: Exception while loading lexicon pickle, regenerating" + print e + lexicon = None f.close() if notify_lexicon_unpickling: t1 = time() -- 2.26.2