Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce58ed3

Browse files
committed
Merge with 3.2: issue #14433
2 parents 0e8ccb8 + e654c11 commit ce58ed3

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.3.0 Alpha 3?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #14433: Prevent msvcrt crash in interactive prompt when stdin
14+
is closed.
15+
1316
- Issue #14521: Make result of float('nan') and float('-nan') more
1417
consistent across platforms.
1518

Parser/myreadline.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ my_fgets(char *buf, int len, FILE *fp)
4242
(void)(PyOS_InputHook)();
4343
errno = 0;
4444
clearerr(fp);
45-
p = fgets(buf, len, fp);
45+
if (_PyVerify_fd(fileno(fp)))
46+
p = fgets(buf, len, fp);
47+
else
48+
p = NULL;
4649
if (p != NULL)
4750
return 0; /* No error */
4851
err = errno;

0 commit comments

Comments
 (0)