Matthias Urlichs

Results 342 comments of Matthias Urlichs

OK, thanks for the explanation. In this case you can create a `concurrent.futures.Future` like this: ```python async def runner(f, proc, args, kw): try: f.set_result(await proc(*args,**kw)) except Exception as exc: f.set_exception(exc)...

(code edited to fix exception handling and stupid argument ordering problems; looks mostly sane now but untested)

So you take the above code snippets and combine them. - add a `set` of open futures to my deadlock detector, above. - teach my `run_async_as_future` code, above, to add...

One warning: there's an open Python bug (filed by me, otherwise untouched so far) where Python does a syscall without releasing the GIL, which would deadlock your program with no...

> the call to isatty only occurs while opening a file in text mode and not in binary mode which was very confusing Actually this makes sense: the call is...

`aclosing()` hits the `subscribe()` generator with a `GeneratorExit` exception, and will ignore that Exception when it gets it back. However, your `subscribe` doesn't (re-)raise that `GeneratorExit` – it raises `MultiError`...

Writing a context manager which does the same thing is left as an exercise to the reader. ;-)

IMHO the way to fix this is to store the stack of the caller of the `.cancel` method so that the actual `Cancelled` exception can use it in a `raise...

Raising an error from within your `__aexit__` instead of closing the stack violates Trio's (Python's, really) core assumptions about how context managers are supposed to be nested / exceptions to...

A channel that drops the oldest enqueued message when a new one arrives (instead of blocking) would be a good building block to have. The backpressure-on-the-fastest-receiver idea is interesting. But...