mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Fail fatally if strdup fails.
This commit is contained in:
parent
cd4d297a23
commit
701abe745b
1 changed files with 4 additions and 0 deletions
|
|
@ -675,6 +675,8 @@ setup_readline(void)
|
|||
{
|
||||
#ifdef SAVE_LOCALE
|
||||
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
|
||||
if (!saved_locale)
|
||||
Py_FatalError("not enough memory to save locale");
|
||||
#endif
|
||||
|
||||
using_history();
|
||||
|
|
@ -823,6 +825,8 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
|
|||
{
|
||||
#ifdef SAVE_LOCALE
|
||||
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
|
||||
if (!saved_locale)
|
||||
Py_FatalError("not enough memory to save locale");
|
||||
setlocale(LC_CTYPE, "");
|
||||
#endif
|
||||
size_t n;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue