Skip to content

Commit 9689244

Browse files
Update src/PyObjectProxyHandler.cc
Co-authored-by: Caleb Aikens <[email protected]>
1 parent 3c1ced2 commit 9689244

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PyObjectProxyHandler.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@ bool PyObjectProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::Handle
174174
PyObject *attrName = idToKey(cx, id);
175175

176176
PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
177-
if (PyObject_SetAttr(self, attrName, pyTypeFactory(cx, rootedV))) {
177+
PyObject *value = pyTypeFactory(cx, rootedV);
178+
if (PyObject_SetAttr(self, attrName, value)) {
179+
Py_DECREF(value);
178180
return result.failCantSetInterposed(); // raises JS exception
179181
}
182+
Py_DECREF(value);
180183
return result.succeed();
181184
}
182185

0 commit comments

Comments
 (0)