PythonExtra/tests/basics/syntaxerror_return.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
472 B
Python
Raw Normal View History

# With MICROPY_CPYTHON_COMPAT, the "return" statement can only appear in a
# function.
# Otherwise (in minimal builds), it ends execution of a module/class.
try:
exec
except NameError:
print("SKIP")
raise SystemExit
try:
exec('return; print("this should not be executed.")')
# if we get here then MICROPY_CPYTHON_COMPAT is disabled and test
# should be skipped.
print("SKIP")
raise SystemExit
except SyntaxError:
print('SyntaxError')