diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-15 22:31:45 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-15 22:31:45 (GMT) |
commit | 307d7a426fee7433e48eb93498d4f250da739589 (patch) | |
tree | 907114003ceba9f907b89c7291157a0ea21d5bfb /Modules/_localemodule.c | |
parent | c8081e9bfa47bbb8278b465d9da6d1097d68341a (diff) | |
download | cpython-307d7a426fee7433e48eb93498d4f250da739589.zip cpython-307d7a426fee7433e48eb93498d4f250da739589.tar.gz cpython-307d7a426fee7433e48eb93498d4f250da739589.tar.bz2 |
Implemented getdefaultlocale() for macintosh, after an idea by Fredrik.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 5b56afe..e32e81b 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -24,7 +24,7 @@ This software comes with no warranty. Use at your own risk. #endif #ifdef macintosh -char *strdup(char *); +#include "macglue.h" #endif static char locale__doc__[] = "Support for POSIX locales."; @@ -380,12 +380,20 @@ PyLocale_getdefaultlocale(PyObject* self, PyObject* args) } #endif +#if defined(macintosh) +static PyObject* +PyLocale_getdefaultlocale(PyObject* self, PyObject* args) +{ + return Py_BuildValue("Os", Py_None, PyMac_getscript()); +} +#endif + static struct PyMethodDef PyLocale_Methods[] = { {"setlocale", (PyCFunction) PyLocale_setlocale, 1, setlocale__doc__}, {"localeconv", (PyCFunction) PyLocale_localeconv, 0, localeconv__doc__}, {"strcoll", (PyCFunction) PyLocale_strcoll, 1, strcoll__doc__}, {"strxfrm", (PyCFunction) PyLocale_strxfrm, 1, strxfrm__doc__}, -#if defined(MS_WIN32) +#if defined(MS_WIN32) || defined(macintosh) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, 0}, #endif {NULL, NULL} |