Skip to content

Commit 1eee738

Browse files
committed
Check unlikely error return from PyDict_DelItemString
1 parent a47b70f commit 1eee738

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
@@ -692,7 +692,9 @@ class cpp_function : public function {
692692
kwargs = reinterpret_steal<dict>(PyDict_Copy(kwargs.ptr()));
693693
copied_kwargs = true;
694694
}
695-
PyDict_DelItemString(kwargs.ptr(), arg_rec.name);
695+
if (PyDict_DelItemString(kwargs.ptr(), arg_rec.name) == -1) {
696+
throw error_already_set();
697+
}
696698
} else if (arg_rec.value) {
697699
value = arg_rec.value;
698700
}

0 commit comments

Comments
 (0)