mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix
the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c.
This commit is contained in:
parent
76450a96ef
commit
4f71101eed
2 changed files with 5 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
if (PyOS_InputHook != NULL)
|
||||
(void)(PyOS_InputHook)();
|
||||
errno = 0;
|
||||
clearerr(fp);
|
||||
p = fgets(buf, len, fp);
|
||||
if (p != NULL)
|
||||
return 0; /* No error */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue