From 829f88c169477c43e642d98e6ca8bfe24857fac4 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Mon, 17 Jul 1995 11:36:01 +0000 Subject: Added GetErrorString method (convert OSErr number to string) --- Mac/Modules/macosmodule.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index c5f14d6..23d3961 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -219,6 +219,16 @@ MacOS_HandleEvent(PyObject *self, PyObject *args) return Py_None; } +static PyObject * +MacOS_GetErrorString(PyObject *self, PyObject *args) +{ + int errn; + + if (!PyArg_ParseTuple(args, "i", &errn)) + return NULL; + return Py_BuildValue("s", PyMac_StrError(errn)); +} + static PyMethodDef MacOS_Methods[] = { {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1}, {"GetCreatorAndType", MacOS_GetCreatorAndType, 1}, @@ -229,6 +239,7 @@ static PyMethodDef MacOS_Methods[] = { {"SetScheduleTimes", MacOS_SetScheduleTimes, 1}, {"EnableAppswitch", MacOS_EnableAppswitch, 1}, {"HandleEvent", MacOS_HandleEvent, 1}, + {"GetErrorString", MacOS_GetErrorString, 1}, {NULL, NULL} /* Sentinel */ }; -- cgit v0.12