Mark raise with no args under finally as an error because it leads to an exception in runtime on Python 2.7 (PY-29763)

This commit is contained in:
Semyon Proshev
2018-11-01 17:55:00 +03:00
parent 80deec23d8
commit 50bf50fa0e
3 changed files with 3 additions and 4 deletions

View File

@@ -264,8 +264,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.raiseHasNoArgsUnderFinally(node, level),
" not support this syntax. Raise with no arguments can only be used in an except block",
node,
null,
false);
null);
// raise 1, 2, 3
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.raiseHasMoreThenOneArg(node, level),

View File

@@ -9,4 +9,4 @@ except:
try:
raise ValueError
finally:
raise
<error descr="Python version 2.7 does not support this syntax. Raise with no arguments can only be used in an except block">raise</error>

View File

@@ -1,4 +1,4 @@
try:
raise ValueError
finally:
<warning descr="Python version 2.6, 2.7 do not support this syntax. Raise with no arguments can only be used in an except block"><warning descr="Python version 2.7 does not support this syntax. Raise with no arguments can only be used in an except block">raise</warning></warning>
<error descr="Python version 2.7 does not support this syntax. Raise with no arguments can only be used in an except block"><warning descr="Python version 2.6, 2.7 do not support this syntax. Raise with no arguments can only be used in an except block">raise</warning></error>