Skip to content

Commit 038f452

Browse files
miss-islingtonpablogsal
andauthoredOct 27, 2021
bpo-45562: Print tokenizer debug messages to stderr (GH-29250) (GH-29252)
(cherry picked from commit 10bbd41) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent 2b7b7c7 commit 038f452

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎Parser/tokenizer.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,9 @@ tok_nextc(struct tok_state *tok)
10461046
}
10471047
#if defined(Py_DEBUG)
10481048
if (Py_DebugFlag) {
1049-
printf("line[%d] = ", tok->lineno);
1049+
fprintf(stderr, "line[%d] = ", tok->lineno);
10501050
print_escape(stdout, tok->cur, tok->inp - tok->cur);
1051-
printf(" tok->done = %d\n", tok->done);
1051+
fprintf(stderr, " tok->done = %d\n", tok->done);
10521052
}
10531053
#endif
10541054
if (!rc) {
@@ -2132,9 +2132,9 @@ PyTokenizer_FindEncoding(int fd)
21322132
void
21332133
tok_dump(int type, char *start, char *end)
21342134
{
2135-
printf("%s", _PyParser_TokenNames[type]);
2135+
fprintf(stderr, "%s", _PyParser_TokenNames[type]);
21362136
if (type == NAME || type == NUMBER || type == STRING || type == OP)
2137-
printf("(%.*s)", (int)(end - start), start);
2137+
fprintf(stderr, "(%.*s)", (int)(end - start), start);
21382138
}
21392139

21402140
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.