diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1999-08-23 11:37:51 +0000 |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1999-08-23 11:37:51 +0000 |
commit | 5aa90b6d2d53fec18b107e8b15682ef5eb9f02ce (patch) | |
tree | 8e649e6e21f8f32781b24ce9f1fcd1ae44ae6ebd /Mac/Modules/gestaltmodule.c | |
parent | bdf94e63121bb5dca4d40ead05d9e1ee7b364b53 (diff) | |
download | cpython-5aa90b6d2d53fec18b107e8b15682ef5eb9f02ce.tar.gz |
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.
Diffstat (limited to 'Mac/Modules/gestaltmodule.c')
-rw-r--r-- | Mac/Modules/gestaltmodule.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c index 8722546742..3cba45b5d5 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); } |