I noticed this too. The patch looks good (on sight, haven't applied it yet).
http://trac.cython.org/cython_trac/ticket/239 On Mar 16, 2009, at 8:15 PM, Hoyt Koepke wrote: > Hello, > > 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 [email protected] > # 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/Scanning.py > --- a/Cython/Compiler/Scanning.py Mon Mar 16 21:33:46 2009 +0100 > +++ b/Cython/Compiler/Scanning.py 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, > regenerating" > + print e > + lexicon = None > + > f.close() > if notify_lexicon_unpickling: > t1 = time() > > -- Hoyt > > > > +++++++++++++++++++++++++++++++++++++++++++++++ > + Hoyt Koepke > + University of Washington Department of Statistics > + http://www.stat.washington.edu/~hoytak/ > + [email protected] > +++++++++++++++++++++++++++++++++++++++++ > +<robust_lexicon_unpickling.diff>_____________________________________ > __________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
