]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Return MacOS.Error in stead of RuntimeError in case of failure so the user
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 23 Aug 1999 11:37:51 +0000 (11:37 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 23 Aug 1999 11:37:51 +0000 (11:37 +0000)
gets a reasonable explanation in stead of a large negative number.

Mac/Modules/gestaltmodule.c

index 87225467427e98802c03034035625e949f031186..3cba45b5d500f549093ec09069e96354b330b50f 100644 (file)
@@ -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 <Types.h>
 #include <Gestalt.h>
@@ -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);
 }