File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -869,28 +869,31 @@ _Py_module_getattro(PyModuleObject *m, PyObject *name)
869
869
static int
870
870
module_setattro (PyModuleObject * mod , PyObject * name , PyObject * value )
871
871
{
872
- PyObject * ret ;
872
+ PyObject * res ;
873
+ int ret ;
873
874
assert (mod -> md_dict != NULL );
874
875
if (value == NULL ) {
875
- PyObject * delattr = PyDict_GetItemWithError (mod -> md_dict , & _Py_ID (__delattr__ ));
876
- if (PyErr_Occurred ()) {
876
+ PyObject * delattr ;
877
+ ret = PyDict_GetItemRef (mod -> md_dict , & _Py_ID (__delattr__ ), & delattr );
878
+ if (ret == -1 ) {
877
879
return -1 ;
878
880
}
879
- if (delattr ) {
880
- ret = PyObject_CallFunctionObjArgs (delattr , name , NULL );
881
- if (ret == NULL ) {
881
+ if (ret ) {
882
+ res = PyObject_CallFunctionObjArgs (delattr , name , NULL );
883
+ if (res == NULL ) {
882
884
return -1 ;
883
885
}
884
886
return 0 ;
885
887
}
886
888
} else {
887
- PyObject * setattr = PyDict_GetItemWithError (mod -> md_dict , & _Py_ID (__setattr__ ));
888
- if (PyErr_Occurred ()) {
889
+ PyObject * setattr ;
890
+ ret = PyDict_GetItemRef (mod -> md_dict , & _Py_ID (__setattr__ ), & setattr );
891
+ if (ret == -1 ) {
889
892
return -1 ;
890
893
}
891
- if (setattr ) {
892
- ret = PyObject_CallFunctionObjArgs (setattr , name , value , NULL );
893
- if (ret == NULL ) {
894
+ if (ret ) {
895
+ res = PyObject_CallFunctionObjArgs (setattr , name , value , NULL );
896
+ if (res == NULL ) {
894
897
return -1 ;
895
898
}
896
899
return 0 ;
You can’t perform that action at this time.
0 commit comments