[issue46843] PersistentTaskGroup API

2022-02-25 Thread Tin Tvrtković
Tin Tvrtković added the comment: The asyncio TaskGroup already uses a WeakSet for its children, so it's suitable for long-lived use. As for errors in siblings aborting the TaskGroup, could you apply a wrapper to the scheduled coroutines to swallow and log any errors yourself? Apart from

[issue46752] Introduce task groups to asyncio and change task cancellation semantics

2022-02-24 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29682 pull_request: https://github.com/python/cpython/pull/31559 ___ Python tracker <https://bugs.python.org/issue46

[issue46752] Introduce task groups to asyncio and change task cancellation semantics

2022-02-23 Thread Tin Tvrtković
Change by Tin Tvrtković : -- nosy: +tinchester nosy_count: 6.0 -> 7.0 pull_requests: +29664 pull_request: https://github.com/python/cpython/pull/31513 ___ Python tracker <https://bugs.python.org/issu

[issue46771] Add some form of cancel scopes

2022-02-22 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29640 pull_request: https://github.com/python/cpython/pull/31513 ___ Python tracker <https://bugs.python.org/issue46

[issue46771] Add some form of cancel scopes

2022-02-22 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29635 pull_request: https://github.com/python/cpython/pull/31508 ___ Python tracker <https://bugs.python.org/issue46

[issue46771] Add some form of cancel scopes

2022-02-21 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29613 pull_request: https://github.com/python/cpython/pull/31483 ___ Python tracker <https://bugs.python.org/issue46

[issue46771] Add some form of cancel scopes

2022-02-20 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29584 pull_request: https://github.com/python/cpython/pull/31434 ___ Python tracker <https://bugs.python.org/issue46

[issue46771] Add some form of cancel scopes

2022-02-20 Thread Tin Tvrtković
Tin Tvrtković added the comment: @Alex you can follow along here: https://github.com/python/cpython/pull/31394 With the cancel_counter approach, a context manager knows whether to handle or propagate the exception by examining its own local state and the remaining counter on the task

[issue46771] Add some form of cancel scopes

2022-02-18 Thread Tin Tvrtković
Change by Tin Tvrtković : -- pull_requests: +29561 pull_request: https://github.com/python/cpython/pull/31415 ___ Python tracker <https://bugs.python.org/issue46

[issue46771] Add some form of cancel scopes

2022-02-18 Thread Tin Tvrtković
Tin Tvrtković added the comment: Sure, I'll be glad to work with Andrew on getting something presentable. Going through the discussion in the issue: * it seems like folks don't think move_on is useful enough to be in the stdlib, I understand that point. Users can always catch the timeout

[issue46771] Add some form of cancel scopes

2022-02-17 Thread Tin Tvrtković
Tin Tvrtković added the comment: Hello Andrew, here's some followup. About the names: the move_on_after and fail_after names are from Trio. I don't have strong feeling about them at all, whatever most people like. About move_on_after vs loop.call_at and loop.call_later: move_on_after is much

[issue46771] Add some form of cancel scopes

2022-02-17 Thread Tin Tvrtković
Tin Tvrtković added the comment: @Guido @Chris Instead of using the message for the nonce we could have a dedicated field for it. I have a proposal though. It's about putting a little logic into the cancellation nonce handling. Let's define the nonce as a float. If you just call

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: @Guido Imagine something_else() takes a long time and a lot of server resources (like a heavy query). If the web server disconnected a tad later and avoided the race condition, the task would have gotten cancelled very soon after the start of something_else

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: Ok, first the happy path. We have a task running this: async def a(): with move_on_after(5): await a_long_op() await something_else() `move_on_after` has scheduled a callback to run that calls `parent_task.cancel(msg=1)` 5 seconds after

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: On the topic of TaskGroups needing to know whether to swallow a child CancelledError or no: just use the same nonce/cancellation context trick? I remember asking Nathaniel about why in Trio nurseries and cancel scopes were linked (nurseries contain a cancel

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: The use of the cancel message is a hack, yeah. But it's what I had to work with. We could introduce a new, proper cancellation context to Tasks instead, which could be attached to the CancelError when it's raised. On the topic of multiple cancellations being

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: Oh, and Trio's `current_effective_deadline` is also in. -- ___ Python tracker <https://bugs.python.org/issue46771> ___ ___ Pytho

[issue46771] Add some form of cancel scopes

2022-02-16 Thread Tin Tvrtković
Tin Tvrtković added the comment: I've essentially forked `async-timeout` (a very good library) into Quattro cancel scopes: https://github.com/Tinche/quattro/blob/main/src/quattro/cancelscope.py. The differences are: * the API follows Trio, so instead of `timeout` you'd use `fail_after

[issue46200] Discourage logging f-strings due to security considerations

2022-02-04 Thread Tin Tvrtković
Tin Tvrtković added the comment: I mean, I agree with your point about being able to accidentally format twice when using the standard library logger. I'm not a core dev but I think getting new APIs in will be challenging. And if by some fluke of chance you did get the approval to introduce

[issue46200] Discourage logging f-strings due to security considerations

2022-02-02 Thread Tin Tvrtković
Tin Tvrtković added the comment: Eric is absolutely right, due to function calls being somewhat slow in Python the performance argument in practice falls in favor of f-strings. So if they're faster, more readable, and more convenient to write, no wonder people prefer them (including me

[issue46404] 3.11a4: a small attrs regression

2022-01-16 Thread Tin Tvrtković
New submission from Tin Tvrtković : We've received a report over at the attrs issue tracker about our test suite failing on Python 3.11. Here's the link: https://github.com/python-attrs/attrs/issues/907 It turns out to be an issue with the no-arg `super()` calls in slotted classes. Here's

[issue44188] ThreadPoolExecutor unbalanced semaphore count

2021-09-02 Thread Tin Tvrtković
Tin Tvrtković added the comment: I was trying to instrument one of our executors to expose some metrics, so I tried using the value of the semaphore as the number of idle threads and I noticed it was way too large. If this was fixed getting these metrics would be easier. -- nosy

[issue42332] add __weakref__ to types.GenericAlias

2020-11-12 Thread Tin Tvrtković
Tin Tvrtković added the comment: It would be great if we could get this into 3.9. -- ___ Python tracker <https://bugs.python.org/issue42332> ___ ___ Python-bug

[issue42332] add __weakref__ to types.GenericAlias

2020-11-12 Thread Tin Tvrtković
New submission from Tin Tvrtković : For example, dict[int, int] cannot be used with singledispatch because types.GenericAlias doesn't support weak references. I'm an author of a third party library (https://github.com/Tinche/cattrs) for which this functionality would be useful. Here's

[issue26664] Misuse of $ in activate.fish of venv

2016-06-30 Thread Tin Tvrtković
Tin Tvrtković added the comment: Thanks for dealing with this, Brett, your efforts are appreciated. :) On Thu, Jun 30, 2016 at 9:24 PM Brett Cannon <rep...@bugs.python.org> wrote: > > Brett Cannon added the comment: > > Activation doesn't "load" the Python interpre

[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-04-26 Thread Tin Tvrtković
Tin Tvrtković added the comment: Also I will add I've been using fish for a long time and have never been affected by #26348. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-04-26 Thread Tin Tvrtković
Changes by Tin Tvrtković <tinches...@gmail.com>: -- versions: +Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26664> ___

[issue26664] find a bug in activate.fish of venv of cpython3.6

2016-04-26 Thread Tin Tvrtković
Tin Tvrtković added the comment: I'm getting this exact issue on Python 3.5 (xenial system installation). All my existing venvs (from before my upgrade to xenial) work. Here's the diff: > diff .venv/bin/activate.fish ../wrapt/.venv/bin/activate.fish 35c35 < set -gx VIRTUAL_ENV "/

[issue17956] add ScheduledExecutor

2016-02-10 Thread Tin Tvrtković
Tin Tvrtković added the comment: It's a shame this has been stuck in review for 2.5 years, I could really use something like this right now. neologix, why don't you put this up on PyPI for a while, at least? -- nosy: +tinchester ___ Python tracker

[issue19542] WeakValueDictionary bug in setdefault()pop()

2015-06-18 Thread Tin Tvrtković
Tin Tvrtković added the comment: We're actually getting bitten by this in production through the Riak Python client, so this isn't a strictly theoretical problem. -- nosy: +tinchester ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Tin Tvrtković
Tin Tvrtković added the comment: For your examples, my first instinct would be to use a thread pool executor. It's a nice high level API and can already do the aggregate join. -- nosy: +tinchester ___ Python tracker rep...@bugs.python.org http

[issue5207] extend strftime/strptime format for RFC3339 and RFC2822

2014-03-13 Thread Tin Tvrtković
Changes by Tin Tvrtković tinches...@gmail.com: -- nosy: +tinchester ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5207 ___ ___ Python-bugs-list