diff options
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/myreadline.c | 5 |
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; |