diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-06-07 15:29:46 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-06-07 15:29:46 (GMT) |
commit | fe8a3d6eebd0143eefc616e4ec312439425a486d (patch) | |
tree | 17e4ded56749a27940a8ca76db2dad7c475cbb74 /Modules/_localemodule.c | |
parent | 2cfca7977e42f6ec034ffe0782f2f1ad7d1efe7f (diff) | |
download | cpython-fe8a3d6eebd0143eefc616e4ec312439425a486d.zip cpython-fe8a3d6eebd0143eefc616e4ec312439425a486d.tar.gz cpython-fe8a3d6eebd0143eefc616e4ec312439425a486d.tar.bz2 |
Fix for issue 6202
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 50378a7..c215ef3 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -363,38 +363,6 @@ PyLocale_getdefaultlocale(PyObject* self) } #endif -#if defined(__APPLE__) -/* -** Find out what the current script is. -** Donated by Fredrik Lundh. -*/ -static char *mac_getscript(void) -{ - CFStringEncoding enc = CFStringGetSystemEncoding(); - static CFStringRef name = NULL; - /* Return the code name for the encodings for which we have codecs. */ - switch(enc) { - case kCFStringEncodingMacRoman: return "mac-roman"; - case kCFStringEncodingMacGreek: return "mac-greek"; - case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; - case kCFStringEncodingMacTurkish: return "mac-turkish"; - case kCFStringEncodingMacIcelandic: return "mac-icelandic"; - /* XXX which one is mac-latin2? */ - } - if (!name) { - /* This leaks an object. */ - name = CFStringConvertEncodingToIANACharSetName(enc); - } - return (char *)CFStringGetCStringPtr(name, 0); -} - -static PyObject* -PyLocale_getdefaultlocale(PyObject* self) -{ - return Py_BuildValue("Os", Py_None, mac_getscript()); -} -#endif - #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} static struct langinfo_constant{ @@ -645,7 +613,7 @@ static struct PyMethodDef PyLocale_Methods[] = { {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, #endif -#if defined(MS_WINDOWS) || defined(__APPLE__) +#if defined(MS_WINDOWS) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H |