From cadf06eab75c887dfc753ca80ef35cd2a7871135 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Sat, 23 Oct 2021 06:35:48 -0700
Subject: bpo-45574: fix warning about `print_escape` being unused (GH-29172)
(#29176)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It used to be like this:
Quick `grep` tells that it is just used in one place under `Py_DEBUG`: https://github.com/python/cpython/blame/f6e8b80d20159596cf641305bad3a833bedd2f4f/Parser/tokenizer.cGH-L1047-L1051
I am not sure, but it also looks like a private thing, it should not affect other users.
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit 4bc5473a42c5eae0928430930b897209492e849d)
Co-authored-by: Nikita Sobolev
Co-authored-by: Nikita Sobolev
---
Misc/NEWS.d/next/Library/2021-10-22-23-06-33.bpo-45574.svqA84.rst | 1 +
Parser/tokenizer.c | 2 ++
2 files changed, 3 insertions(+)
create mode 100644 Misc/NEWS.d/next/Library/2021-10-22-23-06-33.bpo-45574.svqA84.rst
diff --git a/Misc/NEWS.d/next/Library/2021-10-22-23-06-33.bpo-45574.svqA84.rst b/Misc/NEWS.d/next/Library/2021-10-22-23-06-33.bpo-45574.svqA84.rst
new file mode 100644
index 0000000..b404d24
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-10-22-23-06-33.bpo-45574.svqA84.rst
@@ -0,0 +1 @@
+Fix warning about ``print_escape`` being unused.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 53c1028..cd34848 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -994,6 +994,7 @@ tok_underflow_file(struct tok_state *tok) {
return tok->done == E_OK;
}
+#if defined(Py_DEBUG)
static void
print_escape(FILE *f, const char *s, Py_ssize_t size)
{
@@ -1020,6 +1021,7 @@ print_escape(FILE *f, const char *s, Py_ssize_t size)
}
putc('"', f);
}
+#endif
/* Get next char, updating state; error code goes into tok->done */
--
cgit v0.12