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
99b95386
Commit
99b95386
authored
Jul 04, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9642: Uniformize the tests on the availability of the mbcs codec
Add a new HAVE_MBCS define.
parent
9122fdd8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
15 deletions
+22
-15
Include/unicodeobject.h
Include/unicodeobject.h
+6
-2
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_codecsmodule.c
Modules/_codecsmodule.c
+5
-5
Modules/timemodule.c
Modules/timemodule.c
+1
-1
Objects/unicodeobject.c
Objects/unicodeobject.c
+6
-6
Python/bltinmodule.c
Python/bltinmodule.c
+1
-1
No files found.
Include/unicodeobject.h
View file @
99b95386
...
...
@@ -109,6 +109,10 @@ Copyright (c) Corporation for National Research Initiatives.
# endif
#endif
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
# define HAVE_MBCS
#endif
#ifdef HAVE_WCHAR_H
/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */
# ifdef _HAVE_BSDI
...
...
@@ -1162,7 +1166,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
);
#endif
#ifdef
MS_WIN32
#ifdef
HAVE_MBCS
/* --- MBCS codecs for Windows -------------------------------------------- */
...
...
@@ -1191,7 +1195,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
);
#endif
#endif
/*
MS_WIN32
*/
#endif
/*
HAVE_MBCS
*/
/* --- Decimal Encoder ---------------------------------------------------- */
...
...
Misc/NEWS
View file @
99b95386
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
-----------------
- Issue #9642: Uniformize the tests on the availability of the mbcs codec, add
a new HAVE_MBCS define.
- Issue #9642: Fix filesystem encoding initialization: use the ANSI code page
on Windows if the mbcs codec is not available, and fail with a fatal error if
we cannot get the locale encoding (if nl_langinfo(CODESET) is not available)
...
...
Modules/_codecsmodule.c
View file @
99b95386
...
...
@@ -588,7 +588,7 @@ charmap_decode(PyObject *self,
return
codec_tuple
(
unicode
,
pbuf
.
len
);
}
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
static
PyObject
*
mbcs_decode
(
PyObject
*
self
,
...
...
@@ -613,7 +613,7 @@ mbcs_decode(PyObject *self,
return
codec_tuple
(
decoded
,
consumed
);
}
#endif
/*
MS_WINDOW
S */
#endif
/*
HAVE_MBC
S */
/* --- Encoder ------------------------------------------------------------ */
...
...
@@ -989,7 +989,7 @@ charmap_build(PyObject *self, PyObject *args)
return
PyUnicode_BuildEncodingMap
(
map
);
}
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
static
PyObject
*
mbcs_encode
(
PyObject
*
self
,
...
...
@@ -1014,7 +1014,7 @@ mbcs_encode(PyObject *self,
return
v
;
}
#endif
/*
MS_WINDOW
S */
#endif
/*
HAVE_MBC
S */
/* --- Error handler registry --------------------------------------------- */
...
...
@@ -1101,7 +1101,7 @@ static PyMethodDef _codecs_functions[] = {
{
"charmap_decode"
,
charmap_decode
,
METH_VARARGS
},
{
"charmap_build"
,
charmap_build
,
METH_VARARGS
},
{
"readbuffer_encode"
,
readbuffer_encode
,
METH_VARARGS
},
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
{
"mbcs_encode"
,
mbcs_encode
,
METH_VARARGS
},
{
"mbcs_decode"
,
mbcs_decode
,
METH_VARARGS
},
#endif
...
...
Modules/timemodule.c
View file @
99b95386
...
...
@@ -43,7 +43,7 @@ static long main_thread;
#endif
/* MS_WINDOWS */
#endif
/* !__WATCOMC__ || __QNX__ */
#if defined(
MS_WINDOW
S)
#if defined(
HAVE_MBC
S)
# define TZNAME_ENCODING "mbcs"
#else
# define TZNAME_ENCODING "utf-8"
...
...
Objects/unicodeobject.c
View file @
99b95386
...
...
@@ -1506,7 +1506,7 @@ PyUnicode_Decode(const char *s,
(
strcmp
(
lower
,
"latin1"
)
==
0
)
||
(
strcmp
(
lower
,
"iso-8859-1"
)
==
0
))
return
PyUnicode_DecodeLatin1
(
s
,
size
,
errors
);
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
else
if
(
strcmp
(
lower
,
"mbcs"
)
==
0
)
return
PyUnicode_DecodeMBCS
(
s
,
size
,
errors
);
#endif
...
...
@@ -1644,7 +1644,7 @@ PyUnicode_AsEncodedObject(PyObject *unicode,
PyObject
*
PyUnicode_EncodeFSDefault
(
PyObject
*
unicode
)
{
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
return
PyUnicode_EncodeMBCS
(
PyUnicode_AS_UNICODE
(
unicode
),
PyUnicode_GET_SIZE
(
unicode
),
NULL
);
...
...
@@ -1746,7 +1746,7 @@ PyUnicode_AsEncodedString(PyObject *unicode,
return
PyUnicode_EncodeLatin1
(
PyUnicode_AS_UNICODE
(
unicode
),
PyUnicode_GET_SIZE
(
unicode
),
errors
);
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
else
if
(
strcmp
(
lower
,
"mbcs"
)
==
0
)
return
PyUnicode_EncodeMBCS
(
PyUnicode_AS_UNICODE
(
unicode
),
PyUnicode_GET_SIZE
(
unicode
),
...
...
@@ -1848,7 +1848,7 @@ PyUnicode_DecodeFSDefault(const char *s) {
PyObject
*
PyUnicode_DecodeFSDefaultAndSize
(
const
char
*
s
,
Py_ssize_t
size
)
{
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
return
PyUnicode_DecodeMBCS
(
s
,
size
,
NULL
);
#elif defined(__APPLE__)
return
PyUnicode_DecodeUTF8
(
s
,
size
,
"surrogateescape"
);
...
...
@@ -4942,7 +4942,7 @@ PyUnicode_AsASCIIString(PyObject *unicode)
NULL
);
}
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
/* --- MBCS codecs for Windows -------------------------------------------- */
...
...
@@ -5229,7 +5229,7 @@ PyUnicode_AsMBCSString(PyObject *unicode)
#undef NEED_RETRY
#endif
/*
MS_WINDOW
S */
#endif
/*
HAVE_MBC
S */
/* --- Character Mapping Codec -------------------------------------------- */
...
...
Python/bltinmodule.c
View file @
99b95386
...
...
@@ -18,7 +18,7 @@
Don't forget to modify PyUnicode_DecodeFSDefault() if you touch any of the
values for Py_FileSystemDefaultEncoding!
*/
#if
defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
#if
def HAVE_MBCS
const
char
*
Py_FileSystemDefaultEncoding
=
"mbcs"
;
int
Py_HasFileSystemDefaultEncoding
=
1
;
#elif defined(__APPLE__)
...
...
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