-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
np.errstate
is not asyncio-safe
#9444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your solution seems reasonable except that it adds a lot of overhead since you need to call |
Using |
Yeah, he even explains the differences between that proposal and the task locals. So, it seems that one day Python will have this sorted out. Until then, there is probably no point in investing time in a "deprecation context manager". Still having a list of what you would deprecate would be really useful to motivate its creation one day? |
FYI: A competing proposal, PEP 550, is being discussed on python-ideas. |
PEP 567—Context Variables—has been accepted and implemented in Python 3.7. With its new APIs it's now possible to fix this issue. |
The new |
I think this could be attacked now (and would also close gh-19006). Might be nice to see that it doesn't have any performance downsides, but it seemd a bit like contextvars are faster than " This goes way into the depth of the Python C-API, but (as far as I understand right now!) the work used in allocators should outline how this can be achieved: gh-17582 |
While it is threadsafe, the
with
statement gives the false impression that it's always safe. It is not:gives:
because the error-state is thread-local, but asyncio tasks share a thread.
I don't know if there is any way this can be fixed - it seems like this might be a python bug, and context managers might need an
__yield_enter__
and__yield_leave__
mechanism, to be notified when control is leaving the suite via ayield
/await
The text was updated successfully, but these errors were encountered: