Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 28174:3f90d21debe9 legacy-trunk
Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,
and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding.
Adjust test case.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 05 Mar 2003 15:13:47 +0000 |
| parents | 869695cba2cd |
| children | 78395e5b4782 |
comparison
equal
deleted
inserted
replaced
| 28173:5776fd188f20 | 28174:3f90d21debe9 |
|---|---|
| 234 "setdefaultencoding(encoding)\n\ | 234 "setdefaultencoding(encoding)\n\ |
| 235 \n\ | 235 \n\ |
| 236 Set the current default string encoding used by the Unicode implementation." | 236 Set the current default string encoding used by the Unicode implementation." |
| 237 ); | 237 ); |
| 238 | 238 |
| 239 static PyObject * | |
| 240 sys_getfilesystemencoding(PyObject *self) | |
| 241 { | |
| 242 if (Py_FileSystemDefaultEncoding) | |
| 243 return PyString_FromString(Py_FileSystemDefaultEncoding); | |
| 244 Py_INCREF(Py_None); | |
| 245 return Py_None; | |
| 246 } | |
| 247 | |
| 248 PyDoc_STRVAR(getfilesystemencoding_doc, | |
| 249 "getfilesystemencoding() -> string\n\ | |
| 250 \n\ | |
| 251 Return the encoding used to convert Unicode filenames in\n\ | |
| 252 operating system filenames." | |
| 253 ); | |
| 254 | |
| 239 #endif | 255 #endif |
| 240 | 256 |
| 241 /* | 257 /* |
| 242 * Cached interned string objects used for calling the profile and | 258 * Cached interned string objects used for calling the profile and |
| 243 * trace functions. Initialized by trace_init(). | 259 * trace functions. Initialized by trace_init(). |
| 646 #ifdef COUNT_ALLOCS | 662 #ifdef COUNT_ALLOCS |
| 647 {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS}, | 663 {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS}, |
| 648 #endif | 664 #endif |
| 649 #ifdef DYNAMIC_EXECUTION_PROFILE | 665 #ifdef DYNAMIC_EXECUTION_PROFILE |
| 650 {"getdxp", _Py_GetDXProfile, METH_VARARGS}, | 666 {"getdxp", _Py_GetDXProfile, METH_VARARGS}, |
| 667 #endif | |
| 668 #ifdef Py_USING_UNICODE | |
| 669 {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, | |
| 670 METH_NOARGS, getfilesystemencoding_doc}, | |
| 651 #endif | 671 #endif |
| 652 #ifdef Py_TRACE_REFS | 672 #ifdef Py_TRACE_REFS |
| 653 {"getobjects", _Py_GetObjects, METH_VARARGS}, | 673 {"getobjects", _Py_GetObjects, METH_VARARGS}, |
| 654 #endif | 674 #endif |
| 655 #ifdef Py_REF_DEBUG | 675 #ifdef Py_REF_DEBUG |
