Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe8a3d6

Browse files
Fix for issue 6202
1 parent 2cfca79 commit fe8a3d6

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

Lib/locale.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,8 @@ def resetlocale(category=LC_ALL):
536536
"""
537537
_setlocale(category, _build_localename(getdefaultlocale()))
538538

539-
if sys.platform in ('win32', 'darwin', 'mac'):
539+
if sys.platform.startswith("win"):
540540
# On Win32, this will return the ANSI code page
541-
# On the Mac, it should return the system encoding;
542-
# it might return "ascii" instead
543541
def getpreferredencoding(do_setlocale = True):
544542
"""Return the charset that the user is likely using."""
545543
import _locale

Modules/_localemodule.c

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -363,38 +363,6 @@ PyLocale_getdefaultlocale(PyObject* self)
363363
}
364364
#endif
365365

366-
#if defined(__APPLE__)
367-
/*
368-
** Find out what the current script is.
369-
** Donated by Fredrik Lundh.
370-
*/
371-
static char *mac_getscript(void)
372-
{
373-
CFStringEncoding enc = CFStringGetSystemEncoding();
374-
static CFStringRef name = NULL;
375-
/* Return the code name for the encodings for which we have codecs. */
376-
switch(enc) {
377-
case kCFStringEncodingMacRoman: return "mac-roman";
378-
case kCFStringEncodingMacGreek: return "mac-greek";
379-
case kCFStringEncodingMacCyrillic: return "mac-cyrillic";
380-
case kCFStringEncodingMacTurkish: return "mac-turkish";
381-
case kCFStringEncodingMacIcelandic: return "mac-icelandic";
382-
/* XXX which one is mac-latin2? */
383-
}
384-
if (!name) {
385-
/* This leaks an object. */
386-
name = CFStringConvertEncodingToIANACharSetName(enc);
387-
}
388-
return (char *)CFStringGetCStringPtr(name, 0);
389-
}
390-
391-
static PyObject*
392-
PyLocale_getdefaultlocale(PyObject* self)
393-
{
394-
return Py_BuildValue("Os", Py_None, mac_getscript());
395-
}
396-
#endif
397-
398366
#ifdef HAVE_LANGINFO_H
399367
#define LANGINFO(X) {#X, X}
400368
static struct langinfo_constant{
@@ -645,7 +613,7 @@ static struct PyMethodDef PyLocale_Methods[] = {
645613
{"strxfrm", (PyCFunction) PyLocale_strxfrm,
646614
METH_VARARGS, strxfrm__doc__},
647615
#endif
648-
#if defined(MS_WINDOWS) || defined(__APPLE__)
616+
#if defined(MS_WINDOWS)
649617
{"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS},
650618
#endif
651619
#ifdef HAVE_LANGINFO_H

0 commit comments

Comments
 (0)