mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Get rid of all #ifdef Py_USING_UNICODE (it is always present now).
(With the help of unifdef from freshmeat.)
This commit is contained in:
parent
938ef57e26
commit
8d30cc0144
36 changed files with 10 additions and 472 deletions
16
Python/ast.c
16
Python/ast.c
|
@ -3050,10 +3050,6 @@ parsenumber(const char *s)
|
|||
static PyObject *
|
||||
decode_utf8(const char **sPtr, const char *end, char* encoding)
|
||||
{
|
||||
#ifndef Py_USING_UNICODE
|
||||
Py_FatalError("decode_utf8 should not be called in this build.");
|
||||
return NULL;
|
||||
#else
|
||||
PyObject *u, *v;
|
||||
char *s, *t;
|
||||
t = s = (char *)*sPtr;
|
||||
|
@ -3066,7 +3062,6 @@ decode_utf8(const char **sPtr, const char *end, char* encoding)
|
|||
v = PyUnicode_AsEncodedString(u, encoding, NULL);
|
||||
Py_DECREF(u);
|
||||
return v;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -3186,11 +3181,9 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (!*bytesmode) {
|
||||
return decode_unicode(s, len, rawmode, encoding);
|
||||
}
|
||||
#endif
|
||||
if (*bytesmode) {
|
||||
/* Disallow non-ascii characters (but not escapes) */
|
||||
const char *c;
|
||||
|
@ -3207,19 +3200,12 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
|
|||
strcmp(encoding, "iso-8859-1") != 0);
|
||||
if (rawmode || strchr(s, '\\') == NULL) {
|
||||
if (need_encoding) {
|
||||
#ifndef Py_USING_UNICODE
|
||||
/* This should not happen - we never see any other
|
||||
encoding. */
|
||||
Py_FatalError(
|
||||
"cannot deal with encodings in this build.");
|
||||
#else
|
||||
PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL);
|
||||
if (u == NULL)
|
||||
return NULL;
|
||||
v = PyUnicode_AsEncodedString(u, encoding, NULL);
|
||||
Py_DECREF(u);
|
||||
return v;
|
||||
#endif
|
||||
} else {
|
||||
return PyString_FromStringAndSize(s, len);
|
||||
}
|
||||
|
@ -3258,7 +3244,6 @@ parsestrplus(struct compiling *c, const node *n, int *bytesmode)
|
|||
if (v == NULL)
|
||||
goto onError;
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
else {
|
||||
PyObject *temp = PyUnicode_Concat(v, s);
|
||||
Py_DECREF(s);
|
||||
|
@ -3267,7 +3252,6 @@ parsestrplus(struct compiling *c, const node *n, int *bytesmode)
|
|||
if (v == NULL)
|
||||
goto onError;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
|
|
@ -25,9 +25,7 @@ const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
|
|||
|
||||
/* Forward */
|
||||
static PyObject *filterstring(PyObject *, PyObject *);
|
||||
#ifdef Py_USING_UNICODE
|
||||
static PyObject *filterunicode(PyObject *, PyObject *);
|
||||
#endif
|
||||
static PyObject *filtertuple (PyObject *, PyObject *);
|
||||
|
||||
static PyObject *
|
||||
|
@ -272,10 +270,8 @@ builtin_filter(PyObject *self, PyObject *args)
|
|||
/* Strings and tuples return a result of the same type. */
|
||||
if (PyString_Check(seq))
|
||||
return filterstring(func, seq);
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(seq))
|
||||
return filterunicode(func, seq);
|
||||
#endif
|
||||
if (PyTuple_Check(seq))
|
||||
return filtertuple(func, seq);
|
||||
|
||||
|
@ -381,7 +377,6 @@ PyDoc_STRVAR(filter_doc,
|
|||
"or string, return the same type, else return a list.");
|
||||
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
static PyObject *
|
||||
builtin_unichr(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
@ -397,7 +392,6 @@ PyDoc_STRVAR(unichr_doc,
|
|||
"chr(i) -> Unicode character\n\
|
||||
\n\
|
||||
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
|
||||
#endif
|
||||
|
||||
|
||||
static PyObject *
|
||||
|
@ -440,7 +434,6 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
|
||||
cf.cf_flags = supplied_flags;
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(cmd)) {
|
||||
tmp = PyUnicode_AsUTF8String(cmd);
|
||||
if (tmp == NULL)
|
||||
|
@ -448,7 +441,6 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
cmd = tmp;
|
||||
cf.cf_flags |= PyCF_SOURCE_IS_UTF8;
|
||||
}
|
||||
#endif
|
||||
if (PyObject_AsReadBuffer(cmd, (const void **)&str, &length))
|
||||
return NULL;
|
||||
if ((size_t)length != strlen(str)) {
|
||||
|
@ -600,7 +592,6 @@ builtin_eval(PyObject *self, PyObject *args)
|
|||
}
|
||||
cf.cf_flags = 0;
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(cmd)) {
|
||||
tmp = PyUnicode_AsUTF8String(cmd);
|
||||
if (tmp == NULL)
|
||||
|
@ -608,7 +599,6 @@ builtin_eval(PyObject *self, PyObject *args)
|
|||
cmd = tmp;
|
||||
cf.cf_flags |= PyCF_SOURCE_IS_UTF8;
|
||||
}
|
||||
#endif
|
||||
if (PyString_AsStringAndSize(cmd, &str, NULL)) {
|
||||
Py_XDECREF(tmp);
|
||||
return NULL;
|
||||
|
@ -708,7 +698,6 @@ builtin_exec(PyObject *self, PyObject *args)
|
|||
char *str;
|
||||
PyCompilerFlags cf;
|
||||
cf.cf_flags = 0;
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(prog)) {
|
||||
tmp = PyUnicode_AsUTF8String(prog);
|
||||
if (tmp == NULL)
|
||||
|
@ -716,7 +705,6 @@ builtin_exec(PyObject *self, PyObject *args)
|
|||
prog = tmp;
|
||||
cf.cf_flags |= PyCF_SOURCE_IS_UTF8;
|
||||
}
|
||||
#endif
|
||||
if (PyString_AsStringAndSize(prog, &str, NULL))
|
||||
return NULL;
|
||||
if (PyEval_MergeCompilerFlags(&cf))
|
||||
|
@ -850,13 +838,11 @@ builtin_getattr(PyObject *self, PyObject *args)
|
|||
|
||||
if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt))
|
||||
return NULL;
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(name)) {
|
||||
name = _PyUnicode_AsDefaultEncodedString(name, NULL);
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!PyString_Check(name)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
@ -906,13 +892,11 @@ builtin_hasattr(PyObject *self, PyObject *args)
|
|||
|
||||
if (!PyArg_UnpackTuple(args, "hasattr", 2, 2, &v, &name))
|
||||
return NULL;
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(name)) {
|
||||
name = _PyUnicode_AsDefaultEncodedString(name, NULL);
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!PyString_Check(name)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
@ -1471,7 +1455,6 @@ builtin_ord(PyObject *self, PyObject* obj)
|
|||
ord = (long)((unsigned char)*PyString_AS_STRING(obj));
|
||||
return PyInt_FromLong(ord);
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
}
|
||||
else if (PyUnicode_Check(obj)) {
|
||||
size = PyUnicode_GET_SIZE(obj);
|
||||
|
@ -1479,7 +1462,6 @@ builtin_ord(PyObject *self, PyObject* obj)
|
|||
ord = (long)*PyUnicode_AS_UNICODE(obj);
|
||||
return PyInt_FromLong(ord);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (PyBytes_Check(obj)) {
|
||||
/* XXX Hopefully this is temporary */
|
||||
|
@ -2356,9 +2338,7 @@ _PyBuiltin_Init(void)
|
|||
SETBUILTIN("tuple", &PyTuple_Type);
|
||||
SETBUILTIN("type", &PyType_Type);
|
||||
SETBUILTIN("xrange", &PyRange_Type);
|
||||
#ifdef Py_USING_UNICODE
|
||||
SETBUILTIN("unicode", &PyUnicode_Type);
|
||||
#endif
|
||||
debug = PyBool_FromLong(Py_OptimizeFlag == 0);
|
||||
if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
|
||||
Py_XDECREF(debug);
|
||||
|
@ -2536,7 +2516,6 @@ Fail_1:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
/* Helper for filter(): filter a Unicode object through a function */
|
||||
|
||||
static PyObject *
|
||||
|
@ -2630,4 +2609,3 @@ Fail_1:
|
|||
Py_DECREF(result);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -468,7 +468,6 @@ PyObject *PyCodec_StrictErrors(PyObject *exc)
|
|||
}
|
||||
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyObject *PyCodec_IgnoreErrors(PyObject *exc)
|
||||
{
|
||||
Py_ssize_t end;
|
||||
|
@ -729,7 +728,6 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *strict_errors(PyObject *self, PyObject *exc)
|
||||
{
|
||||
|
@ -737,7 +735,6 @@ static PyObject *strict_errors(PyObject *self, PyObject *exc)
|
|||
}
|
||||
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
static PyObject *ignore_errors(PyObject *self, PyObject *exc)
|
||||
{
|
||||
return PyCodec_IgnoreErrors(exc);
|
||||
|
@ -760,7 +757,6 @@ static PyObject *backslashreplace_errors(PyObject *self, PyObject *exc)
|
|||
{
|
||||
return PyCodec_BackslashReplaceErrors(exc);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _PyCodecRegistry_Init(void)
|
||||
{
|
||||
|
@ -777,7 +773,6 @@ static int _PyCodecRegistry_Init(void)
|
|||
METH_O
|
||||
}
|
||||
},
|
||||
#ifdef Py_USING_UNICODE
|
||||
{
|
||||
"ignore",
|
||||
{
|
||||
|
@ -810,7 +805,6 @@ static int _PyCodecRegistry_Init(void)
|
|||
METH_O
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
PyInterpreterState *interp = PyThreadState_GET()->interp;
|
||||
|
|
|
@ -547,9 +547,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
|
||||
const char *format = *p_format;
|
||||
char c = *format++;
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyObject *uarg;
|
||||
#endif
|
||||
|
||||
switch (c) {
|
||||
|
||||
|
@ -780,7 +778,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = PyString_AS_STRING(arg);
|
||||
STORE_SIZE(PyString_GET_SIZE(arg));
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
else if (PyUnicode_Check(arg)) {
|
||||
uarg = UNICODE_DEFAULT_ENCODING(arg);
|
||||
if (uarg == NULL)
|
||||
|
@ -789,7 +786,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = PyString_AS_STRING(uarg);
|
||||
STORE_SIZE(PyString_GET_SIZE(uarg));
|
||||
}
|
||||
#endif
|
||||
else { /* any buffer-like object */
|
||||
char *buf;
|
||||
Py_ssize_t count = convertbuffer(arg, p, &buf);
|
||||
|
@ -803,7 +799,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
|
||||
if (PyString_Check(arg))
|
||||
*p = PyString_AS_STRING(arg);
|
||||
#ifdef Py_USING_UNICODE
|
||||
else if (PyUnicode_Check(arg)) {
|
||||
uarg = UNICODE_DEFAULT_ENCODING(arg);
|
||||
if (uarg == NULL)
|
||||
|
@ -811,7 +806,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
arg, msgbuf, bufsize);
|
||||
*p = PyString_AS_STRING(uarg);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return converterr("string", arg, msgbuf, bufsize);
|
||||
if ((Py_ssize_t)strlen(*p) != PyString_Size(arg))
|
||||
|
@ -834,7 +828,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = PyString_AS_STRING(arg);
|
||||
STORE_SIZE(PyString_GET_SIZE(arg));
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
else if (PyUnicode_Check(arg)) {
|
||||
uarg = UNICODE_DEFAULT_ENCODING(arg);
|
||||
if (uarg == NULL)
|
||||
|
@ -843,7 +836,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = PyString_AS_STRING(uarg);
|
||||
STORE_SIZE(PyString_GET_SIZE(uarg));
|
||||
}
|
||||
#endif
|
||||
else { /* any buffer-like object */
|
||||
char *buf;
|
||||
Py_ssize_t count = convertbuffer(arg, p, &buf);
|
||||
|
@ -859,7 +851,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = 0;
|
||||
else if (PyString_Check(arg))
|
||||
*p = PyString_AS_STRING(arg);
|
||||
#ifdef Py_USING_UNICODE
|
||||
else if (PyUnicode_Check(arg)) {
|
||||
uarg = UNICODE_DEFAULT_ENCODING(arg);
|
||||
if (uarg == NULL)
|
||||
|
@ -867,7 +858,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
arg, msgbuf, bufsize);
|
||||
*p = PyString_AS_STRING(uarg);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return converterr("string or None",
|
||||
arg, msgbuf, bufsize);
|
||||
|
@ -897,10 +887,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
|
||||
/* Get 'e' parameter: the encoding name */
|
||||
encoding = (const char *)va_arg(*p_va, const char *);
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
#endif
|
||||
|
||||
/* Get output buffer parameter:
|
||||
's' (recode all objects via Unicode) or
|
||||
|
@ -926,7 +914,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
Py_INCREF(s);
|
||||
}
|
||||
else {
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyObject *u;
|
||||
|
||||
/* Convert object to Unicode */
|
||||
|
@ -950,9 +937,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
"(encoder failed to return a string)",
|
||||
arg, msgbuf, bufsize);
|
||||
}
|
||||
#else
|
||||
return converterr("string<e>", arg, msgbuf, bufsize);
|
||||
#endif
|
||||
}
|
||||
size = PyString_GET_SIZE(s);
|
||||
|
||||
|
@ -1054,7 +1038,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
case 'u': {/* raw unicode buffer (Py_UNICODE *) */
|
||||
if (*format == '#') { /* any buffer-like object */
|
||||
void **p = (void **)va_arg(*p_va, char **);
|
||||
|
@ -1077,7 +1060,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case 'S': { /* string object */
|
||||
PyObject **p = va_arg(*p_va, PyObject **);
|
||||
|
@ -1088,7 +1070,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
case 'U': { /* Unicode object */
|
||||
PyObject **p = va_arg(*p_va, PyObject **);
|
||||
if (PyUnicode_Check(arg))
|
||||
|
@ -1097,7 +1078,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
return converterr("unicode", arg, msgbuf, bufsize);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case 'O': { /* object */
|
||||
PyTypeObject *type;
|
||||
|
@ -1611,9 +1591,7 @@ skipitem(const char **p_format, va_list *p_va, int flags)
|
|||
|
||||
case 's': /* string */
|
||||
case 'z': /* string or None */
|
||||
#ifdef Py_USING_UNICODE
|
||||
case 'u': /* unicode string */
|
||||
#endif
|
||||
case 't': /* buffer, read-only */
|
||||
case 'w': /* buffer, read-write */
|
||||
{
|
||||
|
@ -1631,9 +1609,7 @@ skipitem(const char **p_format, va_list *p_va, int flags)
|
|||
/* object codes */
|
||||
|
||||
case 'S': /* string object */
|
||||
#ifdef Py_USING_UNICODE
|
||||
case 'U': /* unicode string object */
|
||||
#endif
|
||||
{
|
||||
(void) va_arg(*p_va, PyObject **);
|
||||
break;
|
||||
|
|
|
@ -1256,7 +1256,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
|||
PyObject *v = PyList_GetItem(path, i);
|
||||
if (!v)
|
||||
return NULL;
|
||||
#ifdef Py_USING_UNICODE
|
||||
if (PyUnicode_Check(v)) {
|
||||
copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v),
|
||||
PyUnicode_GET_SIZE(v), Py_FileSystemDefaultEncoding, NULL);
|
||||
|
@ -1265,7 +1264,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
|||
v = copy;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!PyString_Check(v))
|
||||
continue;
|
||||
len = PyString_GET_SIZE(v);
|
||||
|
|
|
@ -254,7 +254,6 @@ w_object(PyObject *v, WFILE *p)
|
|||
w_long((long)n, p);
|
||||
w_string(PyString_AS_STRING(v), (int)n, p);
|
||||
}
|
||||
#ifdef Py_USING_UNICODE
|
||||
else if (PyUnicode_Check(v)) {
|
||||
PyObject *utf8;
|
||||
utf8 = PyUnicode_AsUTF8String(v);
|
||||
|
@ -274,7 +273,6 @@ w_object(PyObject *v, WFILE *p)
|
|||
w_string(PyString_AS_STRING(utf8), (int)n, p);
|
||||
Py_DECREF(utf8);
|
||||
}
|
||||
#endif
|
||||
else if (PyTuple_Check(v)) {
|
||||
w_byte(TYPE_TUPLE, p);
|
||||
n = PyTuple_Size(v);
|
||||
|
@ -678,7 +676,6 @@ r_object(RFILE *p)
|
|||
Py_INCREF(v);
|
||||
return v;
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
case TYPE_UNICODE:
|
||||
{
|
||||
char *buffer;
|
||||
|
@ -701,7 +698,6 @@ r_object(RFILE *p)
|
|||
PyMem_DEL(buffer);
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
case TYPE_TUPLE:
|
||||
n = r_long(p);
|
||||
|
|
|
@ -240,7 +240,6 @@ do_mklist(const char **p_format, va_list *p_va, int endchar, int n, int flags)
|
|||
return v;
|
||||
}
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
static int
|
||||
_ustrlen(Py_UNICODE *u)
|
||||
{
|
||||
|
@ -249,7 +248,6 @@ _ustrlen(Py_UNICODE *u)
|
|||
while (*v != 0) { i++; v++; }
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags)
|
||||
|
@ -349,7 +347,6 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
|
|||
case 'K':
|
||||
return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG));
|
||||
#endif
|
||||
#ifdef Py_USING_UNICODE
|
||||
case 'u':
|
||||
{
|
||||
PyObject *v;
|
||||
|
@ -375,7 +372,6 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
|
|||
}
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
case 'f':
|
||||
case 'd':
|
||||
return PyFloat_FromDouble(
|
||||
|
|
|
@ -152,7 +152,7 @@ Py_InitializeEx(int install_sigs)
|
|||
PyThreadState *tstate;
|
||||
PyObject *bimod, *sysmod;
|
||||
char *p;
|
||||
#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
char *codeset;
|
||||
char *saved_locale;
|
||||
PyObject *sys_stream, *sys_isatty;
|
||||
|
@ -199,10 +199,8 @@ Py_InitializeEx(int install_sigs)
|
|||
if (interp->modules_reloading == NULL)
|
||||
Py_FatalError("Py_Initialize: can't make modules_reloading dictionary");
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
/* Init Unicode implementation; relies on the codec registry */
|
||||
_PyUnicode_Init();
|
||||
#endif
|
||||
|
||||
bimod = _PyBuiltin_Init();
|
||||
if (bimod == NULL)
|
||||
|
@ -250,7 +248,7 @@ Py_InitializeEx(int install_sigs)
|
|||
if (!warnings_module)
|
||||
PyErr_Clear();
|
||||
|
||||
#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
/* On Unix, set the file system encoding according to the
|
||||
user's preference, if the CODESET names a well-known
|
||||
Python codec, and Py_FileSystemDefaultEncoding isn't
|
||||
|
@ -468,10 +466,8 @@ Py_Finalize(void)
|
|||
PyLong_Fini();
|
||||
PyFloat_Fini();
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
/* Cleanup Unicode implementation */
|
||||
_PyUnicode_Fini();
|
||||
#endif
|
||||
|
||||
/* XXX Still allocated:
|
||||
- various static ad-hoc pointers to interned strings
|
||||
|
|
|
@ -210,7 +210,6 @@ If it is another kind of object, it will be printed and the system\n\
|
|||
exit status will be one (i.e., failure)."
|
||||
);
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
|
||||
static PyObject *
|
||||
sys_getdefaultencoding(PyObject *self)
|
||||
|
@ -259,7 +258,6 @@ Return the encoding used to convert Unicode filenames in\n\
|
|||
operating system filenames."
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static PyObject *
|
||||
|
@ -763,10 +761,8 @@ static PyMethodDef sys_methods[] = {
|
|||
{"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc},
|
||||
{"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
|
||||
{"exit", sys_exit, METH_VARARGS, exit_doc},
|
||||
#ifdef Py_USING_UNICODE
|
||||
{"getdefaultencoding", (PyCFunction)sys_getdefaultencoding,
|
||||
METH_NOARGS, getdefaultencoding_doc},
|
||||
#endif
|
||||
#ifdef HAVE_DLOPEN
|
||||
{"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS,
|
||||
getdlopenflags_doc},
|
||||
|
@ -777,10 +773,8 @@ static PyMethodDef sys_methods[] = {
|
|||
#ifdef DYNAMIC_EXECUTION_PROFILE
|
||||
{"getdxp", _Py_GetDXProfile, METH_VARARGS},
|
||||
#endif
|
||||
#ifdef Py_USING_UNICODE
|
||||
{"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding,
|
||||
METH_NOARGS, getfilesystemencoding_doc},
|
||||
#endif
|
||||
#ifdef Py_TRACE_REFS
|
||||
{"getobjects", _Py_GetObjects, METH_VARARGS},
|
||||
#endif
|
||||
|
@ -799,10 +793,8 @@ static PyMethodDef sys_methods[] = {
|
|||
#ifdef USE_MALLOPT
|
||||
{"mdebug", sys_mdebug, METH_VARARGS},
|
||||
#endif
|
||||
#ifdef Py_USING_UNICODE
|
||||
{"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS,
|
||||
setdefaultencoding_doc},
|
||||
#endif
|
||||
{"setcheckinterval", sys_setcheckinterval, METH_VARARGS,
|
||||
setcheckinterval_doc},
|
||||
{"getcheckinterval", sys_getcheckinterval, METH_NOARGS,
|
||||
|
@ -1184,10 +1176,8 @@ _PySys_Init(void)
|
|||
PyString_FromString(Py_GetExecPrefix()));
|
||||
SET_SYS_FROM_STRING("maxint",
|
||||
PyInt_FromLong(PyInt_GetMax()));
|
||||
#ifdef Py_USING_UNICODE
|
||||
SET_SYS_FROM_STRING("maxunicode",
|
||||
PyInt_FromLong(PyUnicode_GetMax()));
|
||||
#endif
|
||||
SET_SYS_FROM_STRING("builtin_module_names",
|
||||
list_builtin_module_names());
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue