summaryrefslogtreecommitdiff
path: root/examples/pythonGrammarParser.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-12-24 17:05:37 -0500
committerJon Dufresne <jon.dufresne@gmail.com>2018-12-24 17:17:09 -0500
commitdf9b2d50b75ee42663195058f3112e6c440381c5 (patch)
treee7f9404d6d5675308f61e5f26acaaced6e66557f /examples/pythonGrammarParser.py
parent7ee59bf9bec777b5a3f627dc2cfbde637ce9ebfc (diff)
downloadpyparsing-git-df9b2d50b75ee42663195058f3112e6c440381c5.tar.gz
Replace bare 'except:' with 'except Exception;'
Catching all exceptions is generally considered a bad practice under most circumstances as it will also catch KeyboardInterrupt and SystemExit. These special cases should be raised to the interpreter to allow the Python process to exit. This fix complies with pycodestyle's error code E722: https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes > do not use bare except, specify exception instead
Diffstat (limited to 'examples/pythonGrammarParser.py')
-rw-r--r--examples/pythonGrammarParser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/pythonGrammarParser.py b/examples/pythonGrammarParser.py
index aed6bbe..ed6a484 100644
--- a/examples/pythonGrammarParser.py
+++ b/examples/pythonGrammarParser.py
@@ -170,7 +170,7 @@ def makeGroupObject(cls):
def groupAction(s,l,t):
try:
return cls(t[0].asList())
- except:
+ except Exception:
return cls(t)
return groupAction