summaryrefslogtreecommitdiff
path: root/ply/lex.py
diff options
context:
space:
mode:
Diffstat (limited to 'ply/lex.py')
-rw-r--r--ply/lex.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ply/lex.py b/ply/lex.py
index eb003c2..c81abe5 100644
--- a/ply/lex.py
+++ b/ply/lex.py
@@ -1038,6 +1038,8 @@ def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',
outputdir = os.path.dirname(srcfile)
try:
lexobj.writetab(lextab, outputdir)
+ if lextab in sys.modules:
+ del sys.modules[lextab]
except IOError as e:
errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e))