diff Python/sysmodule.c @ 19343:7257e87e0720 legacy-trunk

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.
author Martin v. Löwis <martin@v.loewis.de>
date Fri, 17 Aug 2001 18:39:25 +0000
parents b9701538f827
children a4d328d50897
line wrap: on
line diff
--- a/Python/sysmodule.c	Fri Aug 17 17:36:00 2001 +0000
+++ b/Python/sysmodule.c	Fri Aug 17 18:39:25 2001 +0000
@@ -176,6 +176,8 @@
 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 @@
 \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 @@
 	{"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 @@
 #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 @@
 	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);