comparison 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
comparison
equal deleted inserted replaced
19342:8144722dc076 19343:7257e87e0720
174 "getdefaultencoding() -> string\n\ 174 "getdefaultencoding() -> string\n\
175 \n\ 175 \n\
176 Return the current default string encoding used by the Unicode \n\ 176 Return the current default string encoding used by the Unicode \n\
177 implementation."; 177 implementation.";
178 178
179 #ifdef Py_USING_UNICODE
180
179 static PyObject * 181 static PyObject *
180 sys_setdefaultencoding(PyObject *self, PyObject *args) 182 sys_setdefaultencoding(PyObject *self, PyObject *args)
181 { 183 {
182 char *encoding; 184 char *encoding;
183 if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding)) 185 if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding))
190 192
191 static char setdefaultencoding_doc[] = 193 static char setdefaultencoding_doc[] =
192 "setdefaultencoding(encoding)\n\ 194 "setdefaultencoding(encoding)\n\
193 \n\ 195 \n\
194 Set the current default string encoding used by the Unicode implementation."; 196 Set the current default string encoding used by the Unicode implementation.";
197
198 #endif
195 199
196 /* 200 /*
197 * Cached interned string objects used for calling the profile and 201 * Cached interned string objects used for calling the profile and
198 * trace functions. Initialized by trace_init(). 202 * trace functions. Initialized by trace_init().
199 */ 203 */
528 /* Might as well keep this in alphabetic order */ 532 /* Might as well keep this in alphabetic order */
529 {"displayhook", sys_displayhook, METH_O, displayhook_doc}, 533 {"displayhook", sys_displayhook, METH_O, displayhook_doc},
530 {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc}, 534 {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc},
531 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, 535 {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
532 {"exit", sys_exit, METH_OLDARGS, exit_doc}, 536 {"exit", sys_exit, METH_OLDARGS, exit_doc},
537 #ifdef Py_USING_UNICODE
533 {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, 538 {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS,
534 getdefaultencoding_doc}, 539 getdefaultencoding_doc},
540 #endif
535 #ifdef HAVE_DLOPEN 541 #ifdef HAVE_DLOPEN
536 {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, 542 {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS,
537 getdlopenflags_doc}, 543 getdlopenflags_doc},
538 #endif 544 #endif
539 #ifdef COUNT_ALLOCS 545 #ifdef COUNT_ALLOCS
551 getrecursionlimit_doc}, 557 getrecursionlimit_doc},
552 {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, 558 {"_getframe", sys_getframe, METH_VARARGS, getframe_doc},
553 #ifdef USE_MALLOPT 559 #ifdef USE_MALLOPT
554 {"mdebug", sys_mdebug, METH_VARARGS}, 560 {"mdebug", sys_mdebug, METH_VARARGS},
555 #endif 561 #endif
562 #ifdef Py_USING_UNICODE
556 {"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS, 563 {"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS,
557 setdefaultencoding_doc}, 564 setdefaultencoding_doc},
565 #endif
558 {"setcheckinterval", sys_setcheckinterval, METH_VARARGS, 566 {"setcheckinterval", sys_setcheckinterval, METH_VARARGS,
559 setcheckinterval_doc}, 567 setcheckinterval_doc},
560 #ifdef HAVE_DLOPEN 568 #ifdef HAVE_DLOPEN
561 {"setdlopenflags", sys_setdlopenflags, METH_VARARGS, 569 {"setdlopenflags", sys_setdlopenflags, METH_VARARGS,
562 setdlopenflags_doc}, 570 setdlopenflags_doc},
780 v = PyString_FromString(Py_GetExecPrefix())); 788 v = PyString_FromString(Py_GetExecPrefix()));
781 Py_XDECREF(v); 789 Py_XDECREF(v);
782 PyDict_SetItemString(sysdict, "maxint", 790 PyDict_SetItemString(sysdict, "maxint",
783 v = PyInt_FromLong(PyInt_GetMax())); 791 v = PyInt_FromLong(PyInt_GetMax()));
784 Py_XDECREF(v); 792 Py_XDECREF(v);
793 #ifdef Py_USING_UNICODE
785 PyDict_SetItemString(sysdict, "maxunicode", 794 PyDict_SetItemString(sysdict, "maxunicode",
786 v = PyInt_FromLong(PyUnicode_GetMax())); 795 v = PyInt_FromLong(PyUnicode_GetMax()));
787 Py_XDECREF(v); 796 Py_XDECREF(v);
797 #endif
788 PyDict_SetItemString(sysdict, "builtin_module_names", 798 PyDict_SetItemString(sysdict, "builtin_module_names",
789 v = list_builtin_module_names()); 799 v = list_builtin_module_names());
790 Py_XDECREF(v); 800 Py_XDECREF(v);
791 { 801 {
792 /* Assumes that longs are at least 2 bytes long. 802 /* Assumes that longs are at least 2 bytes long.