summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-04-30 04:10:41 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2012-04-30 04:10:41 (GMT)
commite654c11f565d1be32062931dc0a1817004b7387b (patch)
tree9f780a1bd1c6d35773409fc813ddbfccd80889f8 /Parser
parentb8f02b5a5f1d211d83d6cc2a40a9b798d8dcfee2 (diff)
downloadcpython-e654c11f565d1be32062931dc0a1817004b7387b.zip
cpython-e654c11f565d1be32062931dc0a1817004b7387b.tar.gz
cpython-e654c11f565d1be32062931dc0a1817004b7387b.tar.bz2
Issue #14433: Prevent msvcrt crash in interactive prompt when stdin is closed.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/myreadline.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 33d5b3d..cb1cf0f 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -42,7 +42,10 @@ my_fgets(char *buf, int len, FILE *fp)
(void)(PyOS_InputHook)();
errno = 0;
clearerr(fp);
- p = fgets(buf, len, fp);
+ if (_PyVerify_fd(fileno(fp)))
+ p = fgets(buf, len, fp);
+ else
+ p = NULL;
if (p != NULL)
return 0; /* No error */
err = errno;