summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 2f43813..ab10faa 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -120,7 +120,10 @@ test_dict_inner(int count)
for (i = 0; i < count; i++) {
v = PyLong_FromLong(i);
- PyDict_SetItem(dict, v, v);
+ if (PyDict_SetItem(dict, v, v) < 0) {
+ Py_DECREF(v);
+ return -1;
+ }
Py_DECREF(v);
}