Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 28574:be2ecafb15ad legacy-trunk
Move declaration of enc to scope where it is used
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Thu, 10 Apr 2003 21:53:14 +0000 |
| parents | 850626d47574 |
| children | b1671550c7e1 |
comparison
equal
deleted
inserted
replaced
| 28573:da74bdd93441 | 28574:be2ecafb15ad |
|---|---|
| 188 Python codec, and Py_FileSystemDefaultEncoding isn't | 188 Python codec, and Py_FileSystemDefaultEncoding isn't |
| 189 initialized by other means. */ | 189 initialized by other means. */ |
| 190 if (!Py_FileSystemDefaultEncoding) { | 190 if (!Py_FileSystemDefaultEncoding) { |
| 191 char *saved_locale = setlocale(LC_CTYPE, NULL); | 191 char *saved_locale = setlocale(LC_CTYPE, NULL); |
| 192 char *codeset; | 192 char *codeset; |
| 193 PyObject *enc = NULL; | |
| 194 setlocale(LC_CTYPE, ""); | 193 setlocale(LC_CTYPE, ""); |
| 195 codeset = nl_langinfo(CODESET); | 194 codeset = nl_langinfo(CODESET); |
| 196 if (*codeset) { | 195 if (*codeset) { |
| 197 enc = PyCodec_Encoder(codeset); | 196 PyObject *enc = PyCodec_Encoder(codeset); |
| 198 if (enc) { | 197 if (enc) { |
| 199 Py_FileSystemDefaultEncoding = strdup(codeset); | 198 Py_FileSystemDefaultEncoding = strdup(codeset); |
| 200 Py_DECREF(enc); | 199 Py_DECREF(enc); |
| 201 } else | 200 } else |
| 202 PyErr_Clear(); | 201 PyErr_Clear(); |
