Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e73bf4

Browse files
committed
Replace all calls to fprintf(stderr, ...) with PySys_WriteStderr(...).
1 parent 47fbc40 commit 6e73bf4

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Parser/tokenizer.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ tok_nextc(tok)
329329
}
330330
if (tok->done != E_OK) {
331331
if (tok->prompt != NULL)
332-
fprintf(stderr, "\n");
332+
PySys_WriteStderr("\n");
333333
tok->cur = tok->inp;
334334
return EOF;
335335
}
@@ -437,7 +437,7 @@ indenterror(tok)
437437
return 1;
438438
}
439439
if (tok->altwarning) {
440-
fprintf(stderr, "%s: inconsistent tab/space usage\n",
440+
PySys_WriteStderr("%s: inconsistent tab/space usage\n",
441441
tok->filename);
442442
tok->altwarning = 0;
443443
}
@@ -504,7 +504,8 @@ PyTokenizer_Get(tok, p_start, p_end)
504504
else if (col > tok->indstack[tok->indent]) {
505505
/* Indent -- always one */
506506
if (tok->indent+1 >= MAXINDENT) {
507-
fprintf(stderr, "excessive indent\n");
507+
PySys_WriteStderr(
508+
"excessive indent\n");
508509
tok->done = E_TOKEN;
509510
tok->cur = tok->inp;
510511
return ERRORTOKEN;
@@ -575,7 +576,7 @@ PyTokenizer_Get(tok, p_start, p_end)
575576
if (sscanf(tok->cur,
576577
" vi:set tabsize=%d:", &x) == 1 &&
577578
x >= 1 && x <= 40) {
578-
/* fprintf(stderr, "# vi:set tabsize=%d:\n", x); */
579+
/* PySys_WriteStderr("# vi:set tabsize=%d:\n", x); */
579580
tok->tabsize = x;
580581
}
581582
do {
@@ -618,7 +619,7 @@ PyTokenizer_Get(tok, p_start, p_end)
618619

619620
#ifdef macintosh
620621
if (c == '\r') {
621-
fprintf(stderr,
622+
PySys_WriteStderr(
622623
"File contains \\r characters (incorrect line endings?)\n");
623624
tok->done = E_TOKEN;
624625
tok->cur = tok->inp;

0 commit comments

Comments
 (0)