Skip to content

PyType_FromSpec wrong behavior with multiple Py_tp_members #80712

Description

@eduardo-elizondo
BPO 36531
Nosy @eduardo-elizondo, @iritkatriel
PRs
  • bpo-36531: Only count number of members once in PyType_FromSpec #12691
  • 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 = None
    created_at = <Date 2019-04-04.23:53:40.353>
    labels = []
    title = 'PyType_FromSpec wrong behavior with multiple Py_tp_members'
    updated_at = <Date 2020-10-16.22:20:42.440>
    user = 'https://github.com/eduardo-elizondo'

    bugs.python.org fields:

    activity = <Date 2020-10-16.22:20:42.440>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2019-04-04.23:53:40.353>
    creator = 'eelizondo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36531
    keywords = ['patch']
    message_count = 2.0
    messages = ['339468', '378769']
    nosy_count = 2.0
    nosy_names = ['eelizondo', 'iritkatriel']
    pr_nums = ['12691']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36531'
    versions = []

    Activity

    1. eduardo-elizondo commented on Apr 4, 2019

      eduardo-elizondomannequin
      MannequinAuthor

      If a user accidentally defined more than one Py_tp_members in the spec, PyType_FromSpec will ignore all but the last use case. However, the number of members count will cause the type to allocate more memory than needed. This leads to weird behavior and crashes.

      The solution is a one line fix to just restart the count if multiple Py_tp_members are defined.

    2. iritkatriel commented on Oct 16, 2020

      @iritkatriel
      Member

      Can this be closed? Or did you keep it open in order to add a unit test?

    3. transferred this issue fromon Apr 10, 2022
    4. added
      pendingThe issue will be closed if no feedback is provided
      on May 20, 2022
    5. kumaraditya303 commented on Jun 19, 2022

      @kumaraditya303
      Contributor

      Fixed by #93471

    6. removed
      pendingThe issue will be closed if no feedback is provided
      on Jun 19, 2022
    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

      No labels
      No labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions