Commits

Martin von Löwis  committed 2de5e97

Issue #14433: Prevent msvcrt crash in interactive prompt when stdin is closed.

  • Participants
  • Parent commits f23222d
  • Branches 3.2

Comments (0)

Files changed (2)

 Core and Builtins
 -----------------
 
+- Issue #14433: Prevent msvcrt crash in interactive prompt when stdin
+  is closed.
+
 - Issue #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError
   when repr() or str() is called on such an object.
 

File Parser/myreadline.c

             (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;