This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Warning: ‘print_escape’ defined but not used
Type: behavior Stage: resolved
Components: Parser Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, miss-islington, pablogsal, sobolevn
Priority: normal Keywords: patch

Created on 2021-10-22 15:42 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29172 merged sobolevn, 2021-10-22 20:09
PR 29176 merged miss-islington, 2021-10-22 21:57
Messages (3)
msg404786 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2021-10-22 15:42
Recently, GitHub started to show a new warning:

> Check warning on line 999 in Parser/tokenizer.c
> GitHub Actions / Address sanitizer
> Parser/tokenizer.c#L999
> ‘print_escape’ defined but not used [-Wunused-function]

Link: https://github.com/python/cpython/pull/29158/files#file-parser-tokenizer-c-L999

I guess this happens because `print_escape` is only used when `Py_DEBUG` is set:

```
#if defined(Py_DEBUG)
        if (Py_DebugFlag) {
            printf("line[%d] = ", tok->lineno);
            print_escape(stdout, tok->cur, tok->inp - tok->cur);
            printf("  tok->done = %d\n", tok->done);
        }
#endif
```

Will this be a proper fix? Or do we need it for some other reason?

```
#if defined(Py_DEBUG)
static void
print_escape(FILE *f, const char *s, Py_ssize_t size)
// ...
# endif
```

If it's fine, I will send a PR :)
msg404833 - (view) Author: miss-islington (miss-islington) Date: 2021-10-22 21:57
New changeset 4bc5473a42c5eae0928430930b897209492e849d by Nikita Sobolev in branch 'main':
bpo-45574: fix warning about `print_escape` being unused (GH-29172)
https://github.com/python/cpython/commit/4bc5473a42c5eae0928430930b897209492e849d
msg404873 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-10-23 13:35
New changeset cadf06eab75c887dfc753ca80ef35cd2a7871135 by Miss Islington (bot) in branch '3.10':
bpo-45574: fix warning about `print_escape` being unused (GH-29172) (#29176)
https://github.com/python/cpython/commit/cadf06eab75c887dfc753ca80ef35cd2a7871135
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89737
2021-10-23 13:36:15pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-10-23 13:35:56pablogsalsetmessages: + msg404873
2021-10-22 21:57:49miss-islingtonsetpull_requests: + pull_request27449
2021-10-22 21:57:32miss-islingtonsetnosy: + miss-islington
messages: + msg404833
2021-10-22 20:19:18sobolevnsetnosy: + pablogsal, lys.nikolaou

type: behavior
components: + Parser
versions: + Python 3.9, Python 3.10, Python 3.11
2021-10-22 20:09:13sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27445
2021-10-22 15:42:43sobolevncreate