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 — PyType_FromSpec may leak memory with repeated slot IDs · Issue #93466 · python/cpython

PyType_FromSpec may leak memory with repeated slot IDs #93466

New issue
Copy link
New issue
Copy link
Closed
Closed
PyType_FromSpec may leak memory with repeated slot IDs#93466
Copy link
Assignees
encukou
Labels
topic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@encukou
encukou
opened on Jun 3, 2022
Issue body actions

If a slot ID is repeated in PyType_Spec, the current PyType_FromSpec implementation happens to usually use the last one and ignore earlier ones, but:

  • if Py_tp_doc is repeated, PyType_FromSpec may leak memory, and
  • if Py_tp_members is repeated, PyType_FromSpec may memcpy unintialized memory (if slot specifies fewer members than the last one).

We chould:

  • clarify in the docs that repeated slot IDs are not supported
  • raise an exception for duplicate slots (at least when it's easy to detect, as in the cases above)

Alternatively, we could formalize that the last slot of a given ID “wins” and fix the leak/mem issue, but I don't see a use case for this more complex behavior.

Activity

  1. encukou
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    topic-C-API
    on Jun 3, 2022
  2. encukou
    self-assigned this
    on Jun 3, 2022
  3. encukou
    added a commit that references this issue on Jun 10, 2022

    gh-93466: Document PyType_Spec doesn't accept repeated slot IDs; rais…

    21a9a85
  4. encukou
    closed this as completedon Jun 10, 2022
  5. miss-islington
    added a commit that references this issue on Jun 14, 2022

    gh-89546: Clean up PyType_FromMetaclass (GH-93686)

    3597c12
  6. serhiy-storchaka
    added a commit that references this issue on Jun 26, 2022

    Revert 30935 defer bpo45162 to 312 (#94285)

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

Metadata

Metadata

Assignees

  • @encukou
    encukou

Labels

topic-C-APItype-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.