Opened 7 years ago

Closed 7 years ago

#239 closed defect (fixed)

lexicon unpickling

Reported by: robertwb Owned by: robertwb, hoyt
Priority: major Milestone: 0.11.1
Component: Packaging Keywords:


On Mar 16, 2009, at 8:15 PM, Hoyt Koepke wrote:


When upgrading the last cython, it seems that loading the lexicon
pickle failed.  I think I had an incompatible version around
somewhere.  Anyway, the error I got was this:

Compiling module Cython.Plex.Scanners ...
ERROR: ('__init__() takes at least 2 arguments (1 given)', <class
'Cython.Plex.Lexicons.Lexicon'>, ())
Extension module compilation failed, using plain Python implementation
running install

The error occurred while unpickling the lexicon. Under this condition,
it seemed like a good idea to just regenerate the pickle file if
there's an error loading it.  This is what the following patch does:

# HG changeset patch
# User Hoyt Koepke
# Date 1237259414 25200
# Node ID 2ec368843599a624c88fa76735824bb7c1c3ede4
# Parent  137b3d0a0c601f810e36df7530734848cb9bb425
Made lexicon unpickling more robust; on error it regenerates it.

diff -r 137b3d0a0c60 -r 2ec368843599 Cython/Compiler/
--- a/Cython/Compiler/	Mon Mar 16 21:33:46 2009 +0100
+++ b/Cython/Compiler/	Mon Mar 16 20:10:14 2009 -0700
@@ -102,7 +103,14 @@
         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,
+            print e
+            lexicon = None
         if notify_lexicon_unpickling:
             t1 = time()

-- Hoyt

Change History (3)

comment:1 Changed 7 years ago by dagss

  • Milestone changed from 0.10.1 to 0.11.1

comment:3 Changed 7 years ago by robertwb

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.