[Python-checkins] r73268 - in python/branches/py3k: Lib/locale.py Modules/_localemodule.c
ronald.oussoren
python-checkins at python.org
Sun Jun 7 17:29:47 CEST 2009
Author: ronald.oussoren
Date: Sun Jun 7 17:29:46 2009
New Revision: 73268
Log:
Fix for issue 6202
Modified:
python/branches/py3k/Lib/locale.py
python/branches/py3k/Modules/_localemodule.c
Modified: python/branches/py3k/Lib/locale.py
==============================================================================
--- python/branches/py3k/Lib/locale.py (original)
+++ python/branches/py3k/Lib/locale.py Sun Jun 7 17:29:46 2009
@@ -536,10 +536,8 @@
"""
_setlocale(category, _build_localename(getdefaultlocale()))
-if sys.platform in ('win32', 'darwin', 'mac'):
+if sys.platform.startswith("win"):
# On Win32, this will return the ANSI code page
- # On the Mac, it should return the system encoding;
- # it might return "ascii" instead
def getpreferredencoding(do_setlocale = True):
"""Return the charset that the user is likely using."""
import _locale
Modified: python/branches/py3k/Modules/_localemodule.c
==============================================================================
--- python/branches/py3k/Modules/_localemodule.c (original)
+++ python/branches/py3k/Modules/_localemodule.c Sun Jun 7 17:29:46 2009
@@ -363,38 +363,6 @@
}
#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 @@
{"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
More information about the Python-checkins
mailing list