# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 2014-08-14 21:39:27
# Node ID 2965804483e31210b495f5b3cd498a4e3d3272b0
# Parent  0cc2db64c3354fe2624f0a95b0cfa70dd48f5e9b

check-code: extend try/except/finally check for multiple except clauses

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -216,8 +216,9 @@ pypats = [
     (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.*?'