Skip to content

Reference Counting (memory management) Bugs for PyList_SetItem #423

@wr-web

Description

@wr-web

Remove incorrect Py_XDECREF/Py_DECREF call for v_obj.

Related Code

if (PyList_SetItem(a1Wrapper, i, v_obj) < 0)
{

if (PyList_SetItem(a1Wrapper, i, v_obj) < 0)
{

PyList_SetItem Source Code

PyList_SetItem Document

PyList_SetItem Python Forum Discussion

Therefore, whether the function succeeds or fails, it will steal a reference count of the third argument. It must not call Py_XDECREF/Py_DECREF in case of failure.

Similar issue/PR:

PaddlePaddle/Paddle#77447

apache/geaflow#725

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions