Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: ‘print_escape’ defined but not used #89737

Closed
sobolevn opened this issue Oct 22, 2021 · 3 comments
Closed

Warning: ‘print_escape’ defined but not used #89737

sobolevn opened this issue Oct 22, 2021 · 3 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

BPO 45574
Nosy @lysnikolaou, @pablogsal, @miss-islington, @sobolevn
PRs
  • bpo-45574: fix warning about print_escape being unused #29172
  • [3.10] bpo-45574: fix warning about print_escape being unused (GH-29172) #29176
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-10-23.13:36:15.244>
    created_at = <Date 2021-10-22.15:42:43.509>
    labels = ['interpreter-core', 'type-bug', '3.9', '3.10', '3.11']
    title = 'Warning: \xe2\x80\x98print_escape\xe2\x80\x99 defined but not used'
    updated_at = <Date 2021-10-23.13:36:15.244>
    user = 'https://github.com/sobolevn'

    bugs.python.org fields:

    activity = <Date 2021-10-23.13:36:15.244>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-23.13:36:15.244>
    closer = 'pablogsal'
    components = ['Parser']
    creation = <Date 2021-10-22.15:42:43.509>
    creator = 'sobolevn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45574
    keywords = ['patch']
    message_count = 3.0
    messages = ['404786', '404833', '404873']
    nosy_count = 4.0
    nosy_names = ['lys.nikolaou', 'pablogsal', 'miss-islington', 'sobolevn']
    pr_nums = ['29172', '29176']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45574'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @sobolevn
    Copy link
    Member Author

    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 :)

    @sobolevn sobolevn added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes type-bug An unexpected behavior, bug, or error labels Oct 22, 2021
    @miss-islington
    Copy link
    Contributor

    New changeset 4bc5473 by Nikita Sobolev in branch 'main':
    bpo-45574: fix warning about print_escape being unused (GH-29172)
    4bc5473

    @pablogsal
    Copy link
    Member

    New changeset cadf06e by Miss Islington (bot) in branch '3.10':
    bpo-45574: fix warning about print_escape being unused (GH-29172) (bpo-29176)
    cadf06e

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants