Mercurial > cpython-lru_cache-weakref
diff Modules/stdwinmodule.c @ 475:e2c3463c4d91 legacy-trunk
Use new exceptions.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 10 Dec 1991 14:00:03 +0000 |
| parents | 34abca182f18 |
| children | 80e2e5d67b49 |
line wrap: on
line diff
--- a/Modules/stdwinmodule.c Tue Dec 10 13:59:17 1991 +0000 +++ b/Modules/stdwinmodule.c Tue Dec 10 14:00:03 1991 +0000 @@ -68,6 +68,8 @@ #include "stdwin.h" +#define StdwinError RuntimeError /* XXX Change this later */ + /* Window and menu object types declared here because of forward references */ typedef struct { @@ -870,7 +872,7 @@ if (!getrectarg(args, a)) return NULL; if (Drawing != NULL) { - err_setstr(RuntimeError, "already drawing"); + err_setstr(StdwinError, "already drawing"); return NULL; } /* Clip to text area and ignore if area is empty */ @@ -1029,8 +1031,7 @@ return NULL; size = getstringsize(text); if ((buf = NEW(char, size)) == NULL) { - err_set(MemoryError); - return NULL; + return err_nomem(); } memcpy(buf, getstringvalue(text), size); tesetbuf(self->t_text, buf, size); /* Becomes owner of buffer */ @@ -1145,7 +1146,7 @@ break; } if (id >= MAXNMENU) { - err_setstr(MemoryError, "creating too many menus"); + err_setstr(StdwinError, "creating too many menus"); return NULL; } menu = wmenucreate(id + IDOFFSET, getstringvalue(title)); @@ -1374,7 +1375,7 @@ if (!getnoarg(args)) return NULL; if (Drawing != NULL) { - err_setstr(RuntimeError, "already drawing"); + err_setstr(StdwinError, "already drawing"); return NULL; } dp = NEWOBJ(drawingobject, &Drawingtype); @@ -1596,7 +1597,7 @@ return NULL; c = wfetchcursor(getstringvalue(str)); if (c == NULL) { - err_setstr(RuntimeError, "no such cursor"); + err_setstr(StdwinError, "no such cursor"); return NULL; } wsetwincursor(self->w_win, c); @@ -1710,7 +1711,7 @@ break; } if (tag >= MAXNWIN) { - err_setstr(MemoryError, "creating too many windows"); + err_setstr(StdwinError, "creating too many windows"); return NULL; } wp = NEWOBJ(windowobject, &Windowtype); @@ -1766,7 +1767,7 @@ if (!getnoarg(args)) return NULL; if (Drawing != NULL) { - err_setstr(RuntimeError, "cannot getevent() while drawing"); + err_setstr(StdwinError, "cannot getevent() while drawing"); return NULL; } again:
