diff options
| author | Jack Jansen <jack.jansen@cwi.nl> | 1995-07-17 11:36:01 +0000 |
|---|---|---|
| committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-07-17 11:36:01 +0000 |
| commit | 829f88c169477c43e642d98e6ca8bfe24857fac4 (patch) | |
| tree | 06f167425d07a9280aabf0a65eac5bf11c370e94 /Mac/Modules/macosmodule.c | |
| parent | 761c5aba8ecb1f3c4ff90ec76e1fd5639d21d89b (diff) | |
| download | cpython-git-829f88c169477c43e642d98e6ca8bfe24857fac4.tar.gz | |
Added GetErrorString method (convert OSErr number to string)
Diffstat (limited to 'Mac/Modules/macosmodule.c')
| -rw-r--r-- | Mac/Modules/macosmodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index c5f14d6202..23d39611db 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 */ }; |
