mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
bpo-45562: Print tokenizer debug messages to stderr (GH-29250) (GH-29252)
(cherry picked from commit 10bbd41ba8
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
2b7b7c7320
commit
038f452308
1 changed files with 4 additions and 4 deletions
|
@ -1046,9 +1046,9 @@ tok_nextc(struct tok_state *tok)
|
|||
}
|
||||
#if defined(Py_DEBUG)
|
||||
if (Py_DebugFlag) {
|
||||
printf("line[%d] = ", tok->lineno);
|
||||
fprintf(stderr, "line[%d] = ", tok->lineno);
|
||||
print_escape(stdout, tok->cur, tok->inp - tok->cur);
|
||||
printf(" tok->done = %d\n", tok->done);
|
||||
fprintf(stderr, " tok->done = %d\n", tok->done);
|
||||
}
|
||||
#endif
|
||||
if (!rc) {
|
||||
|
@ -2132,9 +2132,9 @@ PyTokenizer_FindEncoding(int fd)
|
|||
void
|
||||
tok_dump(int type, char *start, char *end)
|
||||
{
|
||||
printf("%s", _PyParser_TokenNames[type]);
|
||||
fprintf(stderr, "%s", _PyParser_TokenNames[type]);
|
||||
if (type == NAME || type == NUMBER || type == STRING || type == OP)
|
||||
printf("(%.*s)", (int)(end - start), start);
|
||||
fprintf(stderr, "(%.*s)", (int)(end - start), start);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue