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
|
@ -10,6 +10,10 @@ What's New in Python 3.2.1 release candidate 2?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
- Issue #9670: Increase the default stack size for secondary threads on
|
- Issue #9670: Increase the default stack size for secondary threads on
|
||||||
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
|
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
|
||||||
"maximum recursion depth" RuntimeError exception.
|
"maximum recursion depth" RuntimeError exception.
|
||||||
|
|
|
@ -40,6 +40,7 @@ my_fgets(char *buf, int len, FILE *fp)
|
||||||
if (PyOS_InputHook != NULL)
|
if (PyOS_InputHook != NULL)
|
||||||
(void)(PyOS_InputHook)();
|
(void)(PyOS_InputHook)();
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
clearerr(fp);
|
||||||
p = fgets(buf, len, fp);
|
p = fgets(buf, len, fp);
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
return 0; /* No error */
|
return 0; /* No error */
|
||||||
|
|
Loading…
Reference in New Issue