Mercurial > cpython-lru_cache-weakref
comparison Modules/python.c @ 51902:a5f0371850ff 3.0
Merged revisions 70029 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
r70029 | georg.brandl | 2009-02-27 18:52:38 +0100 (Fr, 27 Feb 2009) | 1 line
another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s.
........
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Fri, 27 Feb 2009 17:54:11 +0000 |
| parents | 26bc0cd0108b |
| children | ac209f132b17 |
comparison
equal
deleted
inserted
replaced
| 51893:db1dbf057147 | 51902:a5f0371850ff |
|---|---|
| 35 #endif | 35 #endif |
| 36 if (!argv_copy || !argv_copy2) { | 36 if (!argv_copy || !argv_copy2) { |
| 37 fprintf(stderr, "out of memory\n"); | 37 fprintf(stderr, "out of memory\n"); |
| 38 return 1; | 38 return 1; |
| 39 } | 39 } |
| 40 oldloc = setlocale(LC_ALL, NULL); | 40 oldloc = strdup(setlocale(LC_ALL, NULL)); |
| 41 setlocale(LC_ALL, ""); | 41 setlocale(LC_ALL, ""); |
| 42 for (i = 0; i < argc; i++) { | 42 for (i = 0; i < argc; i++) { |
| 43 #ifdef HAVE_BROKEN_MBSTOWCS | 43 #ifdef HAVE_BROKEN_MBSTOWCS |
| 44 /* Some platforms have a broken implementation of | 44 /* Some platforms have a broken implementation of |
| 45 * mbstowcs which does not count the characters that | 45 * mbstowcs which does not count the characters that |
| 65 fprintf(stderr, "Could not convert argument %d to string\n", i); | 65 fprintf(stderr, "Could not convert argument %d to string\n", i); |
| 66 return 1; | 66 return 1; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 setlocale(LC_ALL, oldloc); | 69 setlocale(LC_ALL, oldloc); |
| 70 free(oldloc); | |
| 70 res = Py_Main(argc, argv_copy); | 71 res = Py_Main(argc, argv_copy); |
| 71 for (i = 0; i < argc; i++) { | 72 for (i = 0; i < argc; i++) { |
| 72 PyMem_Free(argv_copy2[i]); | 73 PyMem_Free(argv_copy2[i]); |
| 73 } | 74 } |
| 74 PyMem_Free(argv_copy); | 75 PyMem_Free(argv_copy); |
