diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2019-07-13 12:38:30 -0500 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2019-07-13 12:38:30 -0500 |
commit | b295bc146687924af0c51a56157808b528950599 (patch) | |
tree | 1f5c3028dfd6d652189b85c3a35ce0e2f350cccd | |
parent | 4e54534890245fc98721f9a69ab306380d14e13c (diff) | |
download | pyparsing-git-b295bc146687924af0c51a56157808b528950599.tar.gz |
Some code cleanup based on inspection reports
-rw-r--r-- | pyparsing.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pyparsing.py b/pyparsing.py index 8666906..1d532af 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -1321,7 +1321,10 @@ def _trim_arity(func, maxargs=2): if not extract_tb(tb, limit=2)[-1][:2] == pa_call_line_synth: raise finally: - del tb + try: + del tb + except NameError: + pass if limit[0] <= maxargs: limit[0] += 1 @@ -1491,6 +1494,7 @@ class ParserElement(object): _parseMethod = self._parse def breaker(instring, loc, doActions=True, callPreParse=True): import pdb + # this call to pdb.set_trace() is intentional, not a checkin error pdb.set_trace() return _parseMethod( instring, loc, doActions, callPreParse ) breaker._originalParseMethod = _parseMethod @@ -3915,11 +3919,11 @@ class ParseExpression(ParserElement): return self - def validate( self, validateTrace=[] ): - tmp = validateTrace[:]+[self] + def validate(self, validateTrace=None): + tmp = (validateTrace if validateTrace is not None else [])[:]+[self] for e in self.exprs: e.validate(tmp) - self.checkRecursion( [] ) + self.checkRecursion([]) def copy(self): ret = super(ParseExpression,self).copy() |