summaryrefslogtreecommitdiffstats
path: root/Modules/stdwinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-09-04 09:45:18 (GMT)
committerGuido van Rossum <guido@python.org>1992-09-04 09:45:18 (GMT)
commit94472a0374f68fc7c746671eb87dc32253b02f05 (patch)
tree2771e08e0f6355403716eac5d9db818643f7d732 /Modules/stdwinmodule.c
parent9a4e3fc56a2bacc7af884117c53b37fdf104daa2 (diff)
downloadcpython-94472a0374f68fc7c746671eb87dc32253b02f05.zip
cpython-94472a0374f68fc7c746671eb87dc32253b02f05.tar.gz
cpython-94472a0374f68fc7c746671eb87dc32253b02f05.tar.bz2
classobject.c moduleobject.c stdwinmodule.c xxobject.c:
raise AttributeError, not KeyError, when attribute deletion fails. sunaudiodevmodule.c: check for deletion before calling setmember.
Diffstat (limited to 'Modules/stdwinmodule.c')
-rw-r--r--Modules/stdwinmodule.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index e33610d..8b3812b 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -1051,8 +1051,13 @@ text_setattr(tp, name, v)
if (tp->t_attr == NULL)
return -1;
}
- if (v == NULL)
- return dictremove(tp->t_attr, name);
+ if (v == NULL) {
+ int rv = dictremove(tp->t_attr, name);
+ if (rv < 0)
+ err_setstr(AttributeError,
+ "delete non-existing text object attribute");
+ return rv;
+ }
else
return dictinsert(tp->t_attr, name, v);
}
@@ -1253,8 +1258,13 @@ menu_setattr(mp, name, v)
if (mp->m_attr == NULL)
return -1;
}
- if (v == NULL)
- return dictremove(mp->m_attr, name);
+ if (v == NULL) {
+ int rv = dictremove(mp->m_attr, name);
+ if (rv < 0)
+ err_setstr(AttributeError,
+ "delete non-existing menu object attribute");
+ return rv;
+ }
else
return dictinsert(mp->m_attr, name, v);
}
@@ -1655,8 +1665,13 @@ window_setattr(wp, name, v)
if (wp->w_attr == NULL)
return -1;
}
- if (v == NULL)
- return dictremove(wp->w_attr, name);
+ if (v == NULL) {
+ int rv = dictremove(wp->w_attr, name);
+ if (rv < 0)
+ err_setstr(AttributeError,
+ "delete non-existing menu object attribute");
+ return rv;
+ }
else
return dictinsert(wp->w_attr, name, v);
}