On this page
asyncio.BrokenBarrierError
Prev: asyncio.BoundedSemaphore | Up: asyncio | Next: asyncio.BufferedProtocol
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org โ asyncio.BrokenBarrierError
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import BrokenBarrierError
Signature & Overview
asyncio.BrokenBarrierError(...)
Barrier is broken by barrier.abort() call.
Methods & Attributes
BrokenBarrierError.add_note(self, note, /)โ Add a note to the exceptionBrokenBarrierError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import asyncio
async def main():
b = asyncio.Barrier(2)
await b.abort()
try:
await b.wait()
except asyncio.BrokenBarrierError:
assert b.broken is True
asyncio.run(main())
Gotchas
- Requires Python 3.11+: Raised when an
asyncio.Barrieris aborted or reset while tasks are waiting.
REPL Inspect
from asyncio import BrokenBarrierError
help(BrokenBarrierError)
Linked from
Related notes
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BufferedProtocol Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractEventLoop Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractServer Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/Barrier shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseEventLoop shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol shared tags: #asyncio, #stdlib