summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-08-23 11:37:51 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-08-23 11:37:51 (GMT)
commit950269239b4175bf619de8d17e7da5ce5d570e90 (patch)
tree0f658efd5054ed2109b995e8c5effc4a6ed8b8f2
parentc6a164b8bca70952a9320288eb17d8d951651dd8 (diff)
downloadcpython-950269239b4175bf619de8d17e7da5ce5d570e90.zip
cpython-950269239b4175bf619de8d17e7da5ce5d570e90.tar.gz
cpython-950269239b4175bf619de8d17e7da5ce5d570e90.tar.bz2
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.
-rw-r--r--Mac/Modules/gestaltmodule.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c
index 8722546..3cba45b 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 <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);
}