Skip to content

Create companion methods of "PyType_FromSpec*" to allow setting metaclass. #85343

Description

@WildCard65
BPO 41171
Nosy @WildCard65
PRs
  • bpo-41171: Added method "PyMetaType_FromSpec" to allow for specifying the metaclass for the type. #21238
  • 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 2020-06-30.15:34:35.127>
    labels = ['expert-C-API', 'type-feature', '3.8', '3.9', '3.10']
    title = 'Create companion methods of "PyType_FromSpec*" to allow setting metaclass.'
    updated_at = <Date 2020-06-30.16:29:58.229>
    user = 'https://github.com/WildCard65'

    bugs.python.org fields:

    activity = <Date 2020-06-30.16:29:58.229>
    actor = 'WildCard65'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['C API']
    creation = <Date 2020-06-30.15:34:35.127>
    creator = 'WildCard65'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41171
    keywords = ['patch']
    message_count = 2.0
    messages = ['372696', '372697']
    nosy_count = 1.0
    nosy_names = ['WildCard65']
    pr_nums = ['21238']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue41171'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Activity

    1. WildCard65 commented on Jun 30, 2020

      WildCard65mannequin
      MannequinAuthor

      The current goal from what I can tell for Python is to have all C based modules move away from static types and instead use "PyType_FromSpec" and the variant that specifies base classes.

      The only problem is, PyType_FromSpec and it's variant makes the assumption the caller wants "PyType_Type" as the type's metaclass.

      Why not add companion methods to them prefixed with "PyMetaType" and have the "PyType" ones internally invoke these new methods with "PyType_Type" as the metaclass (to keep existing behavior and backwards compatibility)

    2. WildCard65 commented on Jun 30, 2020

      WildCard65mannequin
      MannequinAuthor

      Another thing I thought of, if this is accepted, we can turn the "PyType" methods into header static inline methods.

    3. transferred this issue fromon Apr 10, 2022
    4. kumaraditya303 commented on Nov 30, 2022

      @kumaraditya303
      Contributor

      Duplicate of #60074

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

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions