mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
#2560: remove an unnecessary 'for' loop from my_fgets() in Parser/myreadline.c.
Noted by Joseph Armbruster; patch by Jessica McKellar. The original code was 'for (;;) {...}', where ... ended with a 'return -2' statement and did not contain a 'break' or 'continue' statement. Therefore, the body of the loop is always executed once. Once upon a time there was a 'continue' in the loop, but it was removed in rev36346, committed by mwh on Wed Jul 7 17:44:12 2004.
This commit is contained in:
parent
5cac46dd41
commit
b64d61369a
2 changed files with 54 additions and 54 deletions
|
@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 4?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #2560: remove an unnecessary 'for' loop from my_fgets() in
|
||||||
|
Parser/myreadline.c.
|
||||||
|
|
||||||
- Issue #7988: Fix default alignment to be right aligned for
|
- Issue #7988: Fix default alignment to be right aligned for
|
||||||
complex.__format__. Now it matches other numeric types.
|
complex.__format__. Now it matches other numeric types.
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ static int
|
||||||
my_fgets(char *buf, int len, FILE *fp)
|
my_fgets(char *buf, int len, FILE *fp)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
for (;;) {
|
|
||||||
if (PyOS_InputHook != NULL)
|
if (PyOS_InputHook != NULL)
|
||||||
(void)(PyOS_InputHook)();
|
(void)(PyOS_InputHook)();
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -98,8 +97,6 @@ my_fgets(char *buf, int len, FILE *fp)
|
||||||
return 1; /* Interrupt */
|
return 1; /* Interrupt */
|
||||||
}
|
}
|
||||||
return -2; /* Error */
|
return -2; /* Error */
|
||||||
}
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue