bpo-30747: Attempt to fix atomic load/store#2383
Conversation
|
@Paxxi, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jyasskin, @benjaminp and @akheron to be potential reviewers. |
Sorry, something went wrong.
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
|
It seems you broke the build on Unix: |
Sorry, something went wrong.
|
This should be ready now. Test suite passes for x86/x64, completely untested for ARM as I don't have any suitable environment. I don't really know how to validate that they're correctly atomic. The operations aren't really suitable to implement a ref count or a mutex as a test case so I'm open to ideas of any way to test this. |
Sorry, something went wrong.
I don't think we need to. The potential issues here are extreme edge case race conditions that may happen once a month on heavily-loaded production systems. There's little we can check for in the test suite, IMHO. Longer term, one possibility would be to build Python with thread sanitizer. That's not compatible with MSVC AFAIK, though. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@zooba, do you think you can get some expert at Microsoft to take a look at this? |
Sorry, something went wrong.
|
Added comment about interlocked functions and removed the fence macros as they're not used. |
Sorry, something went wrong.
|
@zooba, do you want to review this pre-merge or should it go ahead? |
Sorry, something went wrong.
|
I think this is ready to merge. Would you like to add a NEWS entry using the "blurb" utility? |
Sorry, something went wrong.
|
I'm not much of a writer so I'd rather skip writing anything about it. Feel free to do it on my behalf if it's considered newsworthy enough. |
Sorry, something went wrong.
|
Well, I'm not sure how to edit your branch, perhaps you can try applying the following patch to it: |
Sorry, something went wrong.
_Py_atomic_* are currently not implemented as atomic operations when building with MSVC. This patch attempts to implement parts of the functionality required.
|
Thanks! I added it to the commit now. Default settings on Github afaik is that repo owners can push directly to a contributors branch for a PR but I didn't know it needed to be part of the commit. Should be all set now. |
Sorry, something went wrong.
|
Ok, thank you! |
Sorry, something went wrong.
Apparently MSVC is too stupid to understand that the alternate branch is not taken and emits a warning for it. Warnings added in python#2383
…#3140) * bpo-9566: Silence warnings from pyatomic.h macros Apparently MSVC is too stupid to understand that the alternate branch is not taken and emits a warning for it. Warnings added in python#2383 * bpo-9566: A better fix for the pyatomic.h warning * bpo-9566: Remove a slash
Py_atomic* are currently not implemented as atomic operations
when building with MSVC. This patch attempts to implement parts
of the functionality required.
https://bugs.python.org/issue30747