Mercurial > cpython-lru_cache-weakref
diff Modules/python.c @ 84502:65f2c92ed079
Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Sun, 07 Jul 2013 23:30:24 +0200 |
| parents | 18bb92b0c458 |
| children | b583fd54c8d6 |
line wrap: on
line diff
--- a/Modules/python.c Sun Jul 07 22:57:45 2013 +0200 +++ b/Modules/python.c Sun Jul 07 23:30:24 2013 +0200 @@ -43,12 +43,12 @@ fpsetmask(m & ~FP_X_OFL); #endif - oldloc = strdup(setlocale(LC_ALL, NULL)); + oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, ""); for (i = 0; i < argc; i++) { argv_copy[i] = _Py_char2wchar(argv[i], NULL); if (!argv_copy[i]) { - free(oldloc); + PyMem_RawFree(oldloc); fprintf(stderr, "Fatal Python error: " "unable to decode the command line argument #%i\n", i + 1); @@ -59,7 +59,7 @@ argv_copy2[argc] = argv_copy[argc] = NULL; setlocale(LC_ALL, oldloc); - free(oldloc); + PyMem_RawFree(oldloc); res = Py_Main(argc, argv_copy); for (i = 0; i < argc; i++) { PyMem_RawFree(argv_copy2[i]);
