Kaydet (Commit) 95026923 authored tarafından Jack Jansen's avatar Jack Jansen

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.
üst c6a164b8
...@@ -25,6 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -25,6 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Macintosh Gestalt interface */ /* Macintosh Gestalt interface */
#include "Python.h" #include "Python.h"
#include "macglue.h"
#include <Types.h> #include <Types.h>
#include <Gestalt.h> #include <Gestalt.h>
...@@ -47,12 +48,8 @@ gestalt_gestalt(self, args) ...@@ -47,12 +48,8 @@ gestalt_gestalt(self, args)
} }
selector = *(OSType*)str; selector = *(OSType*)str;
iErr = Gestalt ( selector, &response ); iErr = Gestalt ( selector, &response );
if (iErr != 0) { if (iErr != 0)
char buf[100]; return PyMac_Error(iErr);
sprintf(buf, "Gestalt error code %d", iErr);
PyErr_SetString(PyExc_RuntimeError, buf);
return NULL;
}
return PyInt_FromLong(response); return PyInt_FromLong(response);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment