ast-check "for" is a loop; sync "withas" test ..

with decompyle3.
This commit is contained in:
rocky
2020-06-04 05:34:19 -04:00
parent 9acb3cf068
commit acdd025162
8 changed files with 15 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -17,6 +17,20 @@ def withas_bug(self, nested, a, b):
with nested(a(), b()) as (x, y): with nested(a(), b()) as (x, y):
1 // 0 1 // 0
# From 3.7.7 test_functools.py
# Bug is a unreachable code after "return"
def test_invalid_registrations(x):
return
with x:
x = 1
# From 3.7.7 test_re.py
# Bug was hooking in c_with.
def test_re_tests(tests):
for t in tests:
with a:
continue
# Adapted from 3.8 distutils/command/config.py # Adapted from 3.8 distutils/command/config.py
# In 3.8 the problem was in handling "with .. as" code # In 3.8 the problem was in handling "with .. as" code
def _gen_temp_sourcefile(x, a, headers, lang): def _gen_temp_sourcefile(x, a, headers, lang):

View File

@@ -14,6 +14,7 @@ def checker(ast, in_loop, errors):
return return
in_loop = ( in_loop = (
in_loop in_loop
or ast.kind.startswith("for")
or ast.kind.startswith("while") or ast.kind.startswith("while")
or ast.kind.startswith("async_for") or ast.kind.startswith("async_for")
) )