summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-10-27 21:27:34 (GMT)
committerGitHub <noreply@github.com>2021-10-27 21:27:34 (GMT)
commit10bbd41ba8c88bc102df108a4e0444abc7c5ea43 (patch)
tree328fc7e3e6772c0ca3d2e9231a9f37daf587be77
parent35e1ff38ee67ee543d9fcb268c3552c5397f9b3f (diff)
downloadcpython-10bbd41ba8c88bc102df108a4e0444abc7c5ea43.zip
cpython-10bbd41ba8c88bc102df108a4e0444abc7c5ea43.tar.gz
cpython-10bbd41ba8c88bc102df108a4e0444abc7c5ea43.tar.bz2
bpo-45562: Print tokenizer debug messages to stderr (GH-29250)
-rw-r--r--Parser/tokenizer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 705da00..4329cdd 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1047,9 +1047,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) {
@@ -2127,8 +2127,8 @@ _PyTokenizer_FindEncodingFilename(int fd, PyObject *filename)
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 // Py_DEBUG