Mercurial > public > mercurial-scm > hg-stable
diff contrib/check-code.py @ 17620:efd1a4378b64
check-code: catch yield inside try/finally (with tests)
This is not allowed in Python 2.4.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 19 Sep 2012 12:29:12 +0200 |
parents | 72803c8edaa4 |
children | cf204e9829f4 |
line wrap: on
line diff
--- a/contrib/check-code.py Tue Sep 18 16:30:21 2012 -0700 +++ b/contrib/check-code.py Wed Sep 19 12:29:12 2012 +0200 @@ -137,6 +137,9 @@ (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)*?)\1\s*yield\b.*?' + r'((?:\n|\1\s.*\n)+?)\1finally:', + 'no yield inside try/finally in Python 2.4'), (r'.{81}', "line too long"), (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), (r'[^\n]\Z', "no trailing newline"),