You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
decimal.getcontext() is not applied within bpython #918
Yikes, that's too bad. Apparently this is a "coroutine-local" thing? So guessing switching from greenlets to threads might not fix, instead it would take moving to async?
Maybe we should manually persist this between execution contexts? I want to learn more about coroutine-locals.
I don't really understand what a coroutine local is yet, but I think it's now sometimes (usually?) a coroutine-local instead based on the value of decimal.HAVE_CONTEXTVAR. Edit: reading more, it sounds like coroutine–locals (contexts) work with threads and additionally work with coroutines, so I think this distinction is not important here (unless we do something with coroutines).
Activity
thomasballinger commentedon Sep 27, 2021
Yikes, that's too bad. Apparently this is a "coroutine-local" thing? So guessing switching from greenlets to threads might not fix, instead it would take moving to async?
Maybe we should manually persist this between execution contexts? I want to learn more about coroutine-locals.
thomasballinger commentedon Sep 27, 2021
This works in Python 3.6 and is broken in 3.7+.
sebastinas commentedon Sep 27, 2021
Why wouldn't this work if we switch to threads? All the user code that is executed would be in exactly one thread.
thomasballinger commentedon Sep 27, 2021
Maybe it will, I meant to say I don't know if it will or not because it's not a thread local, it's something else.
sebastinas commentedon Sep 27, 2021
I'm not sure I can follow. The context is thread-local.
thomasballinger commentedon Sep 27, 2021
I don't really understand what a coroutine local is yet, but I think it's now sometimes (usually?) a coroutine-local instead based on the value of
decimal.HAVE_CONTEXTVAR. Edit: reading more, it sounds like coroutine–locals (contexts) work with threads and additionally work with coroutines, so I think this distinction is not important here (unless we do something with coroutines).nicolaiarocci commentedon Jun 6, 2023
Still needing help with Python 3.11.3. A workaround that might not apply to everyone is resorting to
DefaultContextwhich works as expected: