Skip to content

Commit ba45317

Browse files
Update src/PyDictProxyHandler.cc
Co-authored-by: Caleb Aikens <[email protected]>
1 parent f19708d commit ba45317

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PyDictProxyHandler.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ bool PyDictProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleId
6868
PyObject *attrName = idToKey(cx, id);
6969

7070
PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
71-
if (PyDict_SetItem(self, attrName, pyTypeFactory(cx, rootedV))) {
71+
PyObject *value = pyTypeFactory(cx, rootedV);
72+
if (PyDict_SetItem(self, attrName, value)) {
73+
Py_DECREF(value);
7274
return result.failCantSetInterposed(); // raises JS exception
7375
}
76+
Py_DECREF(value);
7477
return result.succeed();
7578
}
7679

0 commit comments

Comments
 (0)