summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-09-30 17:04:32 (GMT)
committerGitHub <noreply@github.com>2024-09-30 17:04:32 (GMT)
commit077e7ef6a0abbf9e04b9aa11b4f621031004c31f (patch)
tree5ea25ba8a38d2d51779ca3f9aded43b85b969289 /Objects
parentcce1125574f7b74343afda4bd0030706f67e13df (diff)
downloadcpython-077e7ef6a0abbf9e04b9aa11b4f621031004c31f.zip
cpython-077e7ef6a0abbf9e04b9aa11b4f621031004c31f.tar.gz
cpython-077e7ef6a0abbf9e04b9aa11b4f621031004c31f.tar.bz2
gh-124642: Dictionaries aren't marking objects as weakref'd (#124643)
Dictionaries aren't marking objects as weakref'd
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index e50cf8b..ef9d23e 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1488,7 +1488,7 @@ read_failed:
*value_addr = value;
if (value != NULL) {
assert(ix >= 0);
- Py_INCREF(value);
+ _Py_NewRefWithLock(value);
}
Py_END_CRITICAL_SECTION();
return ix;
@@ -7015,7 +7015,7 @@ _PyObject_TryGetInstanceAttribute(PyObject *obj, PyObject *name, PyObject **attr
// Still no dict, we can read from the values
assert(values->valid);
value = values->values[ix];
- *attr = Py_XNewRef(value);
+ *attr = _Py_XNewRefWithLock(value);
success = true;
}
@@ -7035,7 +7035,7 @@ _PyObject_TryGetInstanceAttribute(PyObject *obj, PyObject *name, PyObject **attr
if (dict->ma_values == values && FT_ATOMIC_LOAD_UINT8(values->valid)) {
value = _Py_atomic_load_ptr_relaxed(&values->values[ix]);
- *attr = Py_XNewRef(value);
+ *attr = _Py_XNewRefWithLock(value);
success = true;
} else {
// Caller needs to lookup from the dictionary