Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lexicon unpickling #800

Closed
robertwb opened this issue Mar 17, 2009 · 3 comments
Closed

lexicon unpickling #800

robertwb opened this issue Mar 17, 2009 · 3 comments

Comments

@robertwb
Copy link
Contributor

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 hoytak@gmail.com
# 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

Migrated from http://trac.cython.org/ticket/239

@robertwb
Copy link
Contributor Author

@dagss changed milestone from 0.10.1 to 0.11.1
commented

@robertwb
Copy link
Contributor Author

@robertwb changed owner from hoyt to robertwb, hoyt
commented

Fixed

http://hg.cython.org/cython-devel/rev/964fd03bef43
http://hg.cython.org/cython-devel/rev/77bcc42bfb9d

@robertwb
Copy link
Contributor Author

@robertwb changed resolution to fixed
status from new to closed
commented

@robertwb robertwb added this to the 0.11.1 milestone Aug 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant