Patch from Tim Peters to repare a the problem that tracebacks are off

by a line when Python is run with -x.
This commit is contained in:
Guido van Rossum 1999-04-19 17:54:19 +00:00
parent 9bcd1d7931
commit dc8b569155
1 changed files with 9 additions and 2 deletions

View File

@ -197,8 +197,15 @@ Py_Main(argc, argv)
exit(2);
}
else if (skipfirstline) {
char line[256];
fgets(line, sizeof line, fp);
int ch;
/* Push back first newline so line numbers
remain the same */
while ((ch = getc(fp)) != EOF) {
if (ch == '\n') {
(void)ungetc(ch, fp);
break;
}
}
}
}
}