Uh oh!
There was an error while loading. Please reload this page.
gh-112075: Use atomic exchange in Py_SETREF so updating dict pointers doesn't race - #116620
gh-112075: Use atomic exchange in Py_SETREF so updating dict pointers doesn't race#116620DinoV wants to merge 1 commit into
Conversation
colesbury
commented
Mar 11, 2024
This changes every |
DinoV
commented
Mar 12, 2024
It seems like having this be thread-safe by default and providing a way to opt out of it would be best? There's something like 280 references to this and it seems like around 100 of those are storing into memory which is likely to be shared - and that's just in CPython. |
colesbury
commented
Mar 12, 2024
Making I randomly sampled 10 out of the 262 usages of Sampled call sites |
Updating the dict for an object uses
Py_SETREF. This can race if multiple threads are attempting to do this and dec ref the original value multiple times. This uses_Py_atomic_exchange_ptrto update the existing value and get the previous value for a dec ref.dictobjects thread-safe in--disable-gilbuilds #112075