diff options
author | David Beazley <dave@dabeaz.com> | 2016-08-30 12:36:55 -0500 |
---|---|---|
committer | David Beazley <dave@dabeaz.com> | 2016-08-30 12:36:55 -0500 |
commit | d55082d66c46cb58061617312a0507dbcde51055 (patch) | |
tree | 1a6d3461deae4638eaf0ea32f9e26a24ecbedf38 | |
parent | 40dbd98451aaead653d1282ed88c8bd67b870dbd (diff) | |
download | ply-d55082d66c46cb58061617312a0507dbcde51055.tar.gz |
Fixed Issue #97. Validation of files when original .py file isn't present.
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | ply/lex.py | 5 | ||||
-rw-r--r-- | ply/yacc.py | 5 |
3 files changed, 13 insertions, 2 deletions
@@ -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 @@ -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): |