summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2016-08-30 12:36:55 -0500
committerDavid Beazley <dave@dabeaz.com>2016-08-30 12:36:55 -0500
commitd55082d66c46cb58061617312a0507dbcde51055 (patch)
tree1a6d3461deae4638eaf0ea32f9e26a24ecbedf38
parent40dbd98451aaead653d1282ed88c8bd67b870dbd (diff)
downloadply-d55082d66c46cb58061617312a0507dbcde51055.tar.gz
Fixed Issue #97. Validation of files when original .py file isn't present.
-rw-r--r--CHANGES5
-rw-r--r--ply/lex.py5
-rw-r--r--ply/yacc.py5
3 files changed, 13 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 5c2f48c..ce468c9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
Version 3.9
---------------------
08/30/16: beazley
+ Fixed Issue #97. Failure with code validation when the original
+ source files aren't present. Validation step now ignores
+ the missing file.
+
+08/30/16: beazley
Minor fixes to version numbers.
Version 3.8
diff --git a/ply/lex.py b/ply/lex.py
index c45b8a0..842f05d 100644
--- a/ply/lex.py
+++ b/ply/lex.py
@@ -830,7 +830,10 @@ class LexerReflect(object):
# -----------------------------------------------------------------------------
def validate_module(self, module):
- lines, linen = inspect.getsourcelines(module)
+ try:
+ lines, linen = inspect.getsourcelines(module)
+ except IOError:
+ return
fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(')
sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=')
diff --git a/ply/yacc.py b/ply/yacc.py
index 36d679a..4de39ad 100644
--- a/ply/yacc.py
+++ b/ply/yacc.py
@@ -2979,7 +2979,10 @@ class ParserReflect(object):
fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(')
for module in self.modules:
- lines, linen = inspect.getsourcelines(module)
+ try:
+ lines, linen = inspect.getsourcelines(module)
+ except IOError:
+ continue
counthash = {}
for linen, line in enumerate(lines):