mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
bpo-45562: Print tokenizer debug messages to stderr (GH-29250)
This commit is contained in:
parent
35e1ff38ee
commit
10bbd41ba8
1 changed files with 4 additions and 4 deletions
|
|
@ -1047,9 +1047,9 @@ tok_nextc(struct tok_state *tok)
|
||||||
}
|
}
|
||||||
#if defined(Py_DEBUG)
|
#if defined(Py_DEBUG)
|
||||||
if (Py_DebugFlag) {
|
if (Py_DebugFlag) {
|
||||||
printf("line[%d] = ", tok->lineno);
|
fprintf(stderr, "line[%d] = ", tok->lineno);
|
||||||
print_escape(stdout, tok->cur, tok->inp - tok->cur);
|
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
|
#endif
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
|
|
@ -2127,8 +2127,8 @@ _PyTokenizer_FindEncodingFilename(int fd, PyObject *filename)
|
||||||
void
|
void
|
||||||
tok_dump(int type, char *start, char *end)
|
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)
|
if (type == NAME || type == NUMBER || type == STRING || type == OP)
|
||||||
printf("(%.*s)", (int)(end - start), start);
|
fprintf(stderr, "(%.*s)", (int)(end - start), start);
|
||||||
}
|
}
|
||||||
#endif // Py_DEBUG
|
#endif // Py_DEBUG
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue