GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — New warning: "‘subobj’ may be used uninitialized in this function" in `Objects/bytes_methods.c` · Issue #102941 · python/cpython

New warning: "‘subobj’ may be used uninitialized in this function" in Objects/bytes_methods.c #102941

New issue
Copy link
New issue
Copy link
Closed
Closed
New warning: "‘subobj’ may be used uninitialized in this function" in Objects/bytes_methods.c#102941
Copy link
Assignees
sobolevn
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@sobolevn
sobolevn
opened on Mar 23, 2023
Issue body actions

Example:
Снимок экрана 2023-03-23 в 12 05 59

This looks like a false-positive, because subobj is always initialized in stringlib_parse_args_finds(function_name, args, &subobj, &start, &end):

cpython/Objects/bytes_methods.c

Lines 770 to 786 in 87be8d9

static PyObject *
_Py_bytes_tailmatch(const char *str, Py_ssize_t len,
const char *function_name, PyObject *args,
int direction)
{
Py_ssize_t start = 0;
Py_ssize_t end = PY_SSIZE_T_MAX;
PyObject *subobj;
int result;
if (!stringlib_parse_args_finds(function_name, args, &subobj, &start, &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;
for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
result = tailmatch(str, len, PyTuple_GET_ITEM(subobj, i),
start, end, direction);

Morever, it is used before in PyTuple_Check(subobj).

Any ideas on how to fix / silence it?
And why we get this warning only now? The code was not changed for 10 months.

Linked PRs

  • gh-102941: Fix "‘subobj’ may be used uninitialized in this function" warning in bytes_methods.c #102942

Activity

  1. sobolevn
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Mar 23, 2023
  2. sobolevn commented on Mar 23, 2023

    @sobolevn
    sobolevn
    on Mar 23, 2023
    MemberAuthor
    More actions

    Maybe adding = NULL?

  3. sobolevn
    self-assigned this
    on Mar 23, 2023
  4. sobolevn
    added a commit that references this issue on Mar 23, 2023

    pythongh-102941: Fix "‘subobj’ may be used uninitialized in this func…

    f360cec
  5. sobolevn
    changed the title [-]New warning: "‘subobj’ may be used uninitialized in this function" in ` Objects/bytes_methods.c`[/-] [+]New warning: "‘subobj’ may be used uninitialized in this function" in `Objects/bytes_methods.c`[/+] on Mar 23, 2023
  6. JelleZijlstra
    added a commit that references this issue on Mar 27, 2023

    gh-102941: Fix "‘subobj’ may be used uninitialized in this function" …

    2cdc518
  7. sobolevn
    closed this as completedon Mar 27, 2023
  8. Fidget-Spinner
    added a commit that references this issue on Mar 27, 2023

    pythongh-102941: Fix "‘subobj’ may be used uninitialized in this func…

    0f312ec
  9. warsaw
    added a commit that references this issue on Apr 11, 2023

    pythongh-102941: Fix "‘subobj’ may be used uninitialized in this func…

    0e351ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sobolevn
    sobolevn

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.