Joshua Oreman

Results 120 comments of Joshua Oreman

Here's an implementation of "cancel the nested child before the other children": ``` py @asynccontextmanager async def open_service_nursery() -> AsyncIterator[trio.Nursery]: """Provides a nursery augmented with a cancellation ordering constraint. If...

> I _think_ that if we add this concept of "service nurseries" or some kind of way to control the order that cancellation gets distributed, and remove the bits of...

I think we might be talking about two different things when we talk about "soft cancellation": 1. stop the infinite loops, leave everything else alone (for some amount of time)...

So far I've been imagining Type 2 graceful cancellation support using the tri-state cancel scope model (not cancelled / cancelled but shieldable by "soft-shield" scopes ie "cancelled pending cleanup" /...

The common thread I'm trying to point at with the "type 2 soft cancellation" is the idea that sometimes, while you *can* just tear everything down forcefully, and you need...

Also, it's worth mentioning that I haven't personally encountered any cases where I needed to set both a deadline and a grace period, but I think that's largely because I'm...

I literally just wrote one of these yesterday, with the interface ```python @attr.s(auto_attribs=True) class BufferedReceiveStream(trio.abc.AsyncResource): transport_stream: trio.abc.ReceiveStream chunk_size: int = 4096 async def aclose(self) -> None: ... async def receive(self,...

I wonder if we can improve the ergonomics (i.e., put the exception handler below the code it handles exceptions in, like Python normally does) with something like: ```python try: #...

We could let `handle()` take multiple types, and let users use whatever normal Python method of case-by-types they like: ``` try: ... except: @ExceptionGroup.handle(FooException, BarException) def handler(exc): try: raise exc...

Oh! I had assumed that `ExceptionGroup.catch()` would invoke the handler once for each leaf exception that matches the filter. I would find the other behavior pretty surprising, and I don't...