gh-129983: fix data race in compile_template in sre.c#130015
gh-129983: fix data race in compile_template in sre.c#130015kumaraditya303 merged 9 commits intopython:mainfrom
Conversation
Modules/_sre/sre.c
Outdated
| { | ||
| /* delegate to Python code */ | ||
| PyObject *func = module_state->compile_template; | ||
| PyObject *func = FT_ATOMIC_LOAD_PTR_RELAXED(module_state->compile_template); |
There was a problem hiding this comment.
Let's use FT_ATOMIC_LOAD_PTR here.
FT_ATOMIC_LOAD_PTR_ACQUIRE would probably also be fine, but I think symmetry between the load and store is generally a good idea.
|
I think we can leave the test out for now. I briefly looked at this yesterday, and the other tests in |
|
@kumaraditya303 - is this okay with you? |
np :) |
|
Thanks @tom-pytel for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Sorry, @tom-pytel and @kumaraditya303, I could not cleanly backport this to |
|
Anyone want backport or should I do it? |
I did that already #130038 |
I am assuming the conversation was resolved on the side of the atomic?
I am not sure about the test added here for 3 reasons:
re.sub()before this test so thatre._compile_templatedoesn't get cached yet.The other option would be to make a separate test file just for this case? Overkill I think. So opinion on this requested, maybe don't need test for this?
compile_templateinsre.c#129983