
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
async-exit-stack
Advanced tools
.. role:: python(code) :language: python
.. image:: https://img.shields.io/pypi/v/async_exit_stack.svg :target: https://pypi.python.org/pypi/async_exit_stack
.. image:: https://img.shields.io/travis/sorcio/async_exit_stack.svg :target: https://travis-ci.org/sorcio/async_exit_stack
This package contains code from the CPython project.
::
pip install async_exit_stack
.. code:: python
from async_exit_stack import AsyncExitStack
async def some_async_function():
async with AsyncExitStack() as stack:
connections = [await stack.enter_async_context(get_connection())
for i in range(5)]
# All opened connections will automatically be released at the end of
# the async with statement, even if attempts to open a connection
# later in the list raise an exception.
Refer to Python 3.7 contextlib documentation <https://docs.python.org/3.7/library/contextlib.html#contextlib.AsyncExitStack>_
for a complete reference and more context.
class AsyncExitStack:python:
An asynchronous context manager, similar to ExitStack, that supports combining
both synchronous and asynchronous context managers, as well as having
coroutines for cleanup logic.
The close() method is not implemented, aclose() must be used instead.
enter_async_context(cm):python:
Similar to enter_context() but expects an asynchronous context manager.
push_async_exit(exit):python:
Similar to push() but expects either an asynchronous context manager or a coroutine.
push_async_callback(callback, *args, **kwds):python:
Similar to callback() but expects a coroutine.
aclose():python:
Similar to close() but properly handles awaitables.
FAQs
AsyncExitStack backport for Python 3.5+
We found that async-exit-stack demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.