Skip to content

Instantly share code, notes, and snippets.

@ask
Last active March 22, 2019 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ask/fb1f0aba00a28f62ed6d56453790fc9b to your computer and use it in GitHub Desktop.
Save ask/fb1f0aba00a28f62ed6d56453790fc9b to your computer and use it in GitHub Desktop.
# finally: behavior changed from Python 3.6 to Python 3.7
async def foo():
try:
async for item in Bar():
raise Exception('foo')
except Exception:
pass
class Bar:
async def __aiter__(self):
for i in range(10):
try:
yield i
finally:
print('FOO')
if __name__ == '__main__':
import asyncio
loop = asyncio.get_event_loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment