mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 04:00:28 +01:00
py/compile: Fix handling of unwinding BaseException in async with.
All exceptions that unwind through the async-with must be caught and BaseException is the top-level class, which includes Exception and others. Fixes issue #4552.
This commit is contained in:
@@ -27,3 +27,13 @@ try:
|
||||
o.send(None)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# test raising BaseException to make sure it is handled by the async-with
|
||||
async def h():
|
||||
async with AContext():
|
||||
raise BaseException
|
||||
o = h()
|
||||
try:
|
||||
o.send(None)
|
||||
except BaseException:
|
||||
print('BaseException')
|
||||
|
||||
Reference in New Issue
Block a user