Mercurial > hg-stable
changeset 22175:2965804483e3
check-code: extend try/except/finally check for multiple except clauses
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 Aug 2014 16:39:27 -0500 |
parents | 0cc2db64c335 |
children | 4dd9f606d0a6 |
files | contrib/check-code.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Aug 14 16:39:02 2014 -0500 +++ b/contrib/check-code.py Thu Aug 14 16:39:27 2014 -0500 @@ -216,8 +216,9 @@ (r'(\w|\)),\w', "missing whitespace after ,"), (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), - (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' - r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'), + (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)(\1except.*?:\n' + r'((?:\n|\1\s.*\n)+?))+\1finally:', + 'no try/except/finally in Python 2.4'), (r'(?<!def)(\s+|^|\()next\(.+\)', 'no next(foo) in Python 2.4 and 2.5, use foo.next() instead'), (r'(\s+)try:\n((?:\n|\1\s.*\n)*?)\1\s*yield\b.*?'