From d55082d66c46cb58061617312a0507dbcde51055 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Tue, 30 Aug 2016 12:36:55 -0500 Subject: Fixed Issue #97. Validation of files when original .py file isn't present. --- CHANGES | 5 +++++ ply/lex.py | 5 ++++- ply/yacc.py | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 5c2f48c..ce468c9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ 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. 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): -- cgit v1.2.1