GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-112075: Accessing a single element should optimistically avoid locking by DinoV · Pull Request #115109 · python/cpython Conversation
|
| set_keys(mp, new_keys_object(interp, log2_newsize, unicode)); | ||
| if (mp->ma_keys == NULL) { | ||
| mp->ma_keys = oldkeys; | ||
| set_keys(mp, oldkeys); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think the possible temporary assignment to NULL is thread-safe without the GIL. Let's assign the result of new_keys_object() to a temporary variable and check that before assigning it to mp->ma_keys.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
When I was looking at this function when you made a comment about it on #114741 I realized that the assignment of it to a new empty table isn't right at all! We really need to allocate the new table, copy everything over, and then we can publish it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (hash == -1) | ||
| return NULL; | ||
| } | ||
| #ifdef Py_GIL_DISABLED |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this differ from PyDict_Contains()? Can we just call that?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| PyObject *value; | ||
| Py_ssize_t ix; | ||
|
|
||
| #ifdef Py_GIL_DISABLED |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This also looks like contains_known_hash
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Or does contains_known_hash look like this? 🤔
Sorry, something went wrong.
There was an error while loading. Please reload this page.
54095de to
af7ddb9
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
af7ddb9 to
d608fb3
Compare
…id locking (python#115109) Makes accessing a single element thread safe and typically lock free
…id locking (python#115109) Makes accessing a single element thread safe and typically lock free
…id locking (python#115109) Makes accessing a single element thread safe and typically lock free
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.