From: Jack Jansen Date: Mon, 23 Aug 1999 11:37:51 +0000 (+0000) Subject: Return MacOS.Error in stead of RuntimeError in case of failure so the user X-Git-Tag: v1.6a1~986 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=950269239b4175bf619de8d17e7da5ce5d570e90;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c index 87225467427e..3cba45b5d500 100644 --- a/Mac/Modules/gestaltmodule.c +++ b/Mac/Modules/gestaltmodule.c @@ -25,6 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Macintosh Gestalt interface */ #include "Python.h" +#include "macglue.h" #include #include @@ -47,12 +48,8 @@ gestalt_gestalt(self, args) } 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); }