mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
This commit is contained in:
parent
f75976617b
commit
339d0f720e
42 changed files with 465 additions and 185 deletions
|
@ -176,6 +176,8 @@ static char getdefaultencoding_doc[] =
|
|||
Return the current default string encoding used by the Unicode \n\
|
||||
implementation.";
|
||||
|
||||
#ifdef Py_USING_UNICODE
|
||||
|
||||
static PyObject *
|
||||
sys_setdefaultencoding(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
@ -193,6 +195,8 @@ static char setdefaultencoding_doc[] =
|
|||
\n\
|
||||
Set the current default string encoding used by the Unicode implementation.";
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Cached interned string objects used for calling the profile and
|
||||
* trace functions. Initialized by trace_init().
|
||||
|
@ -530,8 +534,10 @@ static PyMethodDef sys_methods[] = {
|
|||
{"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc},
|
||||
{"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
|
||||
{"exit", sys_exit, METH_OLDARGS, 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},
|
||||
|
@ -553,8 +559,10 @@ 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},
|
||||
#ifdef HAVE_DLOPEN
|
||||
|
@ -782,9 +790,11 @@ _PySys_Init(void)
|
|||
PyDict_SetItemString(sysdict, "maxint",
|
||||
v = PyInt_FromLong(PyInt_GetMax()));
|
||||
Py_XDECREF(v);
|
||||
#ifdef Py_USING_UNICODE
|
||||
PyDict_SetItemString(sysdict, "maxunicode",
|
||||
v = PyInt_FromLong(PyUnicode_GetMax()));
|
||||
Py_XDECREF(v);
|
||||
#endif
|
||||
PyDict_SetItemString(sysdict, "builtin_module_names",
|
||||
v = list_builtin_module_names());
|
||||
Py_XDECREF(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue