[Python-checkins] cpython (3.1): Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
victor.stinner
python-checkins at python.org
Sat Apr 9 16:02:02 CEST 2011
http://hg.python.org/cpython/rev/2222f343ac51
changeset: 69210:2222f343ac51
branch: 3.1
parent: 69201:10725fc76e11
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Sat Apr 09 15:55:44 2011 +0200
summary:
Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
(EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch
written by Charles-Francois Natali.
files:
Misc/NEWS | 4 ++++
Parser/myreadline.c | 9 +++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@
Core and Builtins
-----------------
+- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
+ (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch
+ written by Charles-Francois Natali.
+
- Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
(length bigger than 2^31-1 bytes).
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -36,7 +36,7 @@
my_fgets(char *buf, int len, FILE *fp)
{
char *p;
- for (;;) {
+ while (1) {
if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)();
errno = 0;
@@ -85,9 +85,10 @@
#ifdef WITH_THREAD
PyEval_SaveThread();
#endif
- if (s < 0) {
- return 1;
- }
+ if (s < 0)
+ return 1;
+ /* try again */
+ continue;
}
#endif
if (PyOS_InterruptOccurred()) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list