File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 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)
869869static int
870870module_setattro (PyModuleObject * mod , PyObject * name , PyObject * value )
871871{
872- PyObject * ret ;
872+ PyObject * res ;
873+ int ret ;
873874 assert (mod -> md_dict != NULL );
874875 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 ) {
877879 return -1 ;
878880 }
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 ) {
882884 return -1 ;
883885 }
884886 return 0 ;
885887 }
886888 } 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 ) {
889892 return -1 ;
890893 }
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 ) {
894897 return -1 ;
895898 }
896899 return 0 ;
You can’t perform that action at this time.
0 commit comments