Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fe8a3d6e
Commit
fe8a3d6e
authored
Jun 07, 2009
by
Ronald Oussoren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue 6202
parent
2cfca797
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
36 deletions
+2
-36
Lib/locale.py
Lib/locale.py
+1
-3
Modules/_localemodule.c
Modules/_localemodule.c
+1
-33
No files found.
Lib/locale.py
View file @
fe8a3d6e
...
...
@@ -536,10 +536,8 @@ def resetlocale(category=LC_ALL):
"""
_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
...
...
Modules/_localemodule.c
View file @
fe8a3d6e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment