Skip to content

Commit eb98f16

Browse files
committed
Check unlikely error return from PyDict_DelItemString
1 parent f153746 commit eb98f16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/pybind11/pybind11.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ class cpp_function : public function {
690690
kwargs = reinterpret_steal<dict>(PyDict_Copy(kwargs.ptr()));
691691
copied_kwargs = true;
692692
}
693-
PyDict_DelItemString(kwargs.ptr(), arg_rec.name);
693+
if (PyDict_DelItemString(kwargs.ptr(), arg_rec.name) == -1) {
694+
throw error_already_set();
695+
}
694696
} else if (arg_rec.value) {
695697
value = arg_rec.value;
696698
}

0 commit comments

Comments
 (0)