Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
WildCard65 mannequin opened this issue Jun 30, 2020 · 3 comments
Closed

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

WildCard65 mannequin opened this issue Jun 30, 2020 · 3 comments
Labels
3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes topic-C-API type-feature A feature request or enhancement

Comments

@WildCard65
Copy link
Mannequin

WildCard65 mannequin commented Jun 30, 2020

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']

    @WildCard65
    Copy link
    Mannequin Author

    WildCard65 mannequin commented Jun 30, 2020

    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)

    @WildCard65 WildCard65 mannequin added 3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes topic-C-API type-feature A feature request or enhancement labels Jun 30, 2020
    @WildCard65
    Copy link
    Mannequin Author

    WildCard65 mannequin commented Jun 30, 2020

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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @kumaraditya303
    Copy link
    Contributor

    Duplicate of #60074

    @kumaraditya303 kumaraditya303 marked this as a duplicate of #60074 Nov 30, 2022
    @kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes topic-C-API type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant