You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
ast-check "for" is a loop; sync "withas" test ..
with decompyle3.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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):
|
||||||
|
@@ -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")
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user