@@ -636,7 +636,7 @@ class cpp_function : public function {
636
636
bool bad_arg = false ;
637
637
for (; args_copied < args_to_copy; ++args_copied) {
638
638
const argument_record *arg_rec = args_copied < func.args .size () ? &func.args [args_copied] : nullptr ;
639
- if (kwargs_in && arg_rec && arg_rec->name && PyDict_GetItemString (kwargs_in, arg_rec->name )) {
639
+ if (kwargs_in && arg_rec && arg_rec->name && dict_getitemstring (kwargs_in, arg_rec->name )) {
640
640
bad_arg = true ;
641
641
break ;
642
642
}
@@ -684,15 +684,17 @@ class cpp_function : public function {
684
684
685
685
handle value;
686
686
if (kwargs_in && arg_rec.name )
687
- value = PyDict_GetItemString (kwargs.ptr (), arg_rec.name );
687
+ value = dict_getitemstring (kwargs.ptr (), arg_rec.name );
688
688
689
689
if (value) {
690
690
// Consume a kwargs value
691
691
if (!copied_kwargs) {
692
692
kwargs = reinterpret_steal<dict>(PyDict_Copy (kwargs.ptr ()));
693
693
copied_kwargs = true ;
694
694
}
695
- PyDict_DelItemString (kwargs.ptr (), arg_rec.name );
695
+ if (PyDict_DelItemString (kwargs.ptr (), arg_rec.name ) == -1 ) {
696
+ throw error_already_set ();
697
+ }
696
698
} else if (arg_rec.value ) {
697
699
value = arg_rec.value ;
698
700
}
@@ -2139,7 +2141,7 @@ inline function get_type_override(const void *this_ptr, const type_info *this_ty
2139
2141
if (frame && (std::string) str (frame->f_code ->co_name ) == name &&
2140
2142
frame->f_code ->co_argcount > 0 ) {
2141
2143
PyFrame_FastToLocals (frame);
2142
- PyObject *self_caller = PyDict_GetItem (
2144
+ PyObject *self_caller = dict_getitem (
2143
2145
frame->f_locals , PyTuple_GET_ITEM (frame->f_code ->co_varnames , 0 ));
2144
2146
if (self_caller == self.ptr ())
2145
2147
return function ();
0 commit comments