Skip to content

Missing Py_CLEAR/Py_VISIT calls for Unpickler.persistent_load_attr and Pickler.persistent_id_attr #130179

Description

@sergey-miryanov

Bug report

Bug description:

I found that Unpickler.persistent_load_attr and Pickler.persistent_id_attr can be set, but never clear. However, I didn't find any uses of them.

Another issue, I found that PDATA_APPEND and PDATA_PUSH may lead to memory leaks if PyErr_NoMemory is raised. What do we do about resources when this happens? I've seen resources get cleared, and sometimes they don't.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Feb 16, 2025
  2. added a commit that references this issue on Feb 16, 2025
  3. changed the title [-]Possible memory leaks in _pickle[/-] [+]`_pickle`: Missing `Py_CLEAR/Py_VISIT` calls for `Unpickler.persistent_load_attr` and `Pickler.persistent_id_attr`[/+] on Feb 16, 2025
  4. changed the title [-]`_pickle`: Missing `Py_CLEAR/Py_VISIT` calls for `Unpickler.persistent_load_attr` and `Pickler.persistent_id_attr`[/-] [+]Missing `Py_CLEAR/Py_VISIT` calls for `Unpickler.persistent_load_attr` and `Pickler.persistent_id_attr`[/+] on Feb 16, 2025
  5. added a commit that references this issue on Feb 16, 2025
  6. added a commit that references this issue on Feb 16, 2025
  7. added a commit that references this issue on Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions