-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-124642: Dictionaries aren't marking objects as weakref'd #124643
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
Conversation
@@ -1488,7 +1488,7 @@ _Py_dict_lookup_threadsafe(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyOb | |||
*value_addr = value; | |||
if (value != NULL) { | |||
assert(ix >= 0); | |||
Py_INCREF(value); | |||
_Py_NewRefWithLock(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a test for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not a great way to test this short of actually inspecting the ob_ref_shared
field which isn't something we've done yet in free-threaded builds, so I'm not sure we want/need one.
The end result is just poor performance, but that's difficult to measure. It also requires a pretty particular set of circumstances to manifest, e.g. the shared ref count needs to already be 0 when we're increfing it here.
a4820a6
to
6c286b2
Compare
Thanks @DinoV for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…thonGH-124643) Dictionaries aren't marking objects as weakref'd (cherry picked from commit 077e7ef) Co-authored-by: Dino Viehland <dinoviehland@meta.com>
GH-124798 is a backport of this pull request to the 3.13 branch. |
Uh oh!
There was an error while loading. Please reload this page.