Mercurial > cpython-lru_cache-weakref
diff Mac/Modules/gestaltmodule.c @ 11220:8bb27f4ebe16 legacy-trunk
Return MacOS.Error in stead of RuntimeError in case of failure so the user
gets a reasonable explanation in stead of a large negative number.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Mon, 23 Aug 1999 11:37:51 +0000 |
| parents | bd708fe1934b |
| children | 2211c8995a5f |
line wrap: on
line diff
--- a/Mac/Modules/gestaltmodule.c Fri Aug 20 19:11:27 1999 +0000 +++ b/Mac/Modules/gestaltmodule.c Mon Aug 23 11:37:51 1999 +0000 @@ -25,6 +25,7 @@ /* Macintosh Gestalt interface */ #include "Python.h" +#include "macglue.h" #include <Types.h> #include <Gestalt.h> @@ -47,12 +48,8 @@ } selector = *(OSType*)str; iErr = Gestalt ( selector, &response ); - if (iErr != 0) { - char buf[100]; - sprintf(buf, "Gestalt error code %d", iErr); - PyErr_SetString(PyExc_RuntimeError, buf); - return NULL; - } + if (iErr != 0) + return PyMac_Error(iErr); return PyInt_FromLong(response); }
