##// END OF EJS Templates
check-code: catch yield inside try/finally (with tests)...
Thomas Arendsen Hein -
r17620:efd1a437 default
parent child Browse files
Show More
@@ -137,6 +137,9 b' pypats = ['
137 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
137 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
138 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
138 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
139 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'),
139 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'),
140 (r'(\s+)try:\n((?:\n|\1\s.*\n)*?)\1\s*yield\b.*?'
141 r'((?:\n|\1\s.*\n)+?)\1finally:',
142 'no yield inside try/finally in Python 2.4'),
140 (r'.{81}', "line too long"),
143 (r'.{81}', "line too long"),
141 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
144 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
142 (r'[^\n]\Z', "no trailing newline"),
145 (r'[^\n]\Z', "no trailing newline"),
@@ -43,6 +43,19 b''
43 > pass
43 > pass
44 > finally:
44 > finally:
45 > pass
45 > pass
46 >
47 > # yield inside a try/finally block is not allowed in Python 2.4
48 > try:
49 > pass
50 > yield 1
51 > finally:
52 > pass
53 > try:
54 > yield
55 > pass
56 > finally:
57 > pass
58 >
46 > EOF
59 > EOF
47 $ cat > classstyle.py <<EOF
60 $ cat > classstyle.py <<EOF
48 > class newstyle_class(object):
61 > class newstyle_class(object):
@@ -84,6 +97,12 b''
84 ./non-py24.py:11:
97 ./non-py24.py:11:
85 > try:
98 > try:
86 no try/except/finally in Python 2.4
99 no try/except/finally in Python 2.4
100 ./non-py24.py:28:
101 > try:
102 no yield inside try/finally in Python 2.4
103 ./non-py24.py:33:
104 > try:
105 no yield inside try/finally in Python 2.4
87 ./classstyle.py:4:
106 ./classstyle.py:4:
88 > class oldstyle_class:
107 > class oldstyle_class:
89 old-style class, use class foo(object)
108 old-style class, use class foo(object)
General Comments 0
You need to be logged in to leave comments. Login now