Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 12877:78231bbe605d legacy-trunk
Marc-Andre Lemburg <mal@lemburg.com>:
Changed the API names for setting the default encoding.
These are now in line with the other hooks API names
(no underscores).
| author | Marc-André Lemburg <mal@egenix.com> |
|---|---|
| date | Wed, 07 Jun 2000 09:13:41 +0000 |
| parents | c92668766f5d |
| children | 04c89d77dfdb |
comparison
equal
deleted
inserted
replaced
| 12876:243593f11fcf | 12877:78231bbe605d |
|---|---|
| 141 If the status numeric, it will be used as the system exit status.\n\ | 141 If the status numeric, it will be used as the system exit status.\n\ |
| 142 If it is another kind of object, it will be printed and the system\n\ | 142 If it is another kind of object, it will be printed and the system\n\ |
| 143 exit status will be one (i.e., failure)."; | 143 exit status will be one (i.e., failure)."; |
| 144 | 144 |
| 145 static PyObject * | 145 static PyObject * |
| 146 sys_get_string_encoding(self, args) | 146 sys_getdefaultencoding(self, args) |
| 147 PyObject *self; | 147 PyObject *self; |
| 148 PyObject *args; | 148 PyObject *args; |
| 149 { | 149 { |
| 150 if (!PyArg_ParseTuple(args, ":get_string_encoding")) | 150 if (!PyArg_ParseTuple(args, ":getdefaultencoding")) |
| 151 return NULL; | 151 return NULL; |
| 152 return PyString_FromString(PyUnicode_GetDefaultEncoding()); | 152 return PyString_FromString(PyUnicode_GetDefaultEncoding()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static char get_string_encoding_doc[] = | 155 static char getdefaultencoding_doc[] = |
| 156 "get_string_encoding() -> string\n\ | 156 "getdefaultencoding() -> string\n\ |
| 157 \n\ | 157 \n\ |
| 158 Return the current default string encoding used by the Unicode \n\ | 158 Return the current default string encoding used by the Unicode \n\ |
| 159 implementation."; | 159 implementation."; |
| 160 | 160 |
| 161 static PyObject * | 161 static PyObject * |
| 162 sys_set_string_encoding(self, args) | 162 sys_setdefaultencoding(self, args) |
| 163 PyObject *self; | 163 PyObject *self; |
| 164 PyObject *args; | 164 PyObject *args; |
| 165 { | 165 { |
| 166 char *encoding; | 166 char *encoding; |
| 167 if (!PyArg_ParseTuple(args, "s:set_string_encoding", &encoding)) | 167 if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding)) |
| 168 return NULL; | 168 return NULL; |
| 169 if (PyUnicode_SetDefaultEncoding(encoding)) | 169 if (PyUnicode_SetDefaultEncoding(encoding)) |
| 170 return NULL; | 170 return NULL; |
| 171 Py_INCREF(Py_None); | 171 Py_INCREF(Py_None); |
| 172 return Py_None; | 172 return Py_None; |
| 173 } | 173 } |
| 174 | 174 |
| 175 static char set_string_encoding_doc[] = | 175 static char setdefaultencoding_doc[] = |
| 176 "set_string_encoding(encoding)\n\ | 176 "setdefaultencoding(encoding)\n\ |
| 177 \n\ | 177 \n\ |
| 178 Set the current default string encoding used by the Unicode implementation."; | 178 Set the current default string encoding used by the Unicode implementation."; |
| 179 | 179 |
| 180 static PyObject * | 180 static PyObject * |
| 181 sys_settrace(self, args) | 181 sys_settrace(self, args) |
| 299 | 299 |
| 300 static PyMethodDef sys_methods[] = { | 300 static PyMethodDef sys_methods[] = { |
| 301 /* Might as well keep this in alphabetic order */ | 301 /* Might as well keep this in alphabetic order */ |
| 302 {"exc_info", sys_exc_info, 1, exc_info_doc}, | 302 {"exc_info", sys_exc_info, 1, exc_info_doc}, |
| 303 {"exit", sys_exit, 0, exit_doc}, | 303 {"exit", sys_exit, 0, exit_doc}, |
| 304 {"get_string_encoding", sys_get_string_encoding, 1, get_string_encoding_doc}, | 304 {"getdefaultencoding", sys_getdefaultencoding, 1, getdefaultencoding_doc}, |
| 305 #ifdef COUNT_ALLOCS | 305 #ifdef COUNT_ALLOCS |
| 306 {"getcounts", sys_getcounts, 1}, | 306 {"getcounts", sys_getcounts, 1}, |
| 307 #endif | 307 #endif |
| 308 #ifdef DYNAMIC_EXECUTION_PROFILE | 308 #ifdef DYNAMIC_EXECUTION_PROFILE |
| 309 {"getdxp", _Py_GetDXProfile, 1}, | 309 {"getdxp", _Py_GetDXProfile, 1}, |
| 313 #endif | 313 #endif |
| 314 {"getrefcount", sys_getrefcount, 1, getrefcount_doc}, | 314 {"getrefcount", sys_getrefcount, 1, getrefcount_doc}, |
| 315 #ifdef USE_MALLOPT | 315 #ifdef USE_MALLOPT |
| 316 {"mdebug", sys_mdebug, 1}, | 316 {"mdebug", sys_mdebug, 1}, |
| 317 #endif | 317 #endif |
| 318 {"set_string_encoding", sys_set_string_encoding, 1, set_string_encoding_doc}, | 318 {"setdefaultencoding", sys_setdefaultencoding, 1, setdefaultencoding_doc}, |
| 319 {"setcheckinterval", sys_setcheckinterval, 1, setcheckinterval_doc}, | 319 {"setcheckinterval", sys_setcheckinterval, 1, setcheckinterval_doc}, |
| 320 {"setprofile", sys_setprofile, 0, setprofile_doc}, | 320 {"setprofile", sys_setprofile, 0, setprofile_doc}, |
| 321 {"settrace", sys_settrace, 0, settrace_doc}, | 321 {"settrace", sys_settrace, 0, settrace_doc}, |
| 322 {NULL, NULL} /* sentinel */ | 322 {NULL, NULL} /* sentinel */ |
| 323 }; | 323 }; |
