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

Support passing single class to PyType_FromSpecWithBases and PyType_FromModuleAndSpec #86589

Closed
serhiy-storchaka opened this issue Nov 21, 2020 · 3 comments
Labels
3.10 expert-C-API type-feature

Comments

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Nov 21, 2020

BPO 42423
Nosy @tiran, @encukou, @serhiy-storchaka
PRs
  • #23441
  • 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 = <Date 2020-11-22.11:53:56.680>
    created_at = <Date 2020-11-21.10:19:14.565>
    labels = ['expert-C-API', 'type-feature', '3.10']
    title = 'Support passing single class to PyType_FromSpecWithBases and PyType_FromModuleAndSpec'
    updated_at = <Date 2020-11-22.11:53:56.680>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2020-11-22.11:53:56.680>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-11-22.11:53:56.680>
    closer = 'serhiy.storchaka'
    components = ['C API']
    creation = <Date 2020-11-21.10:19:14.565>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42423
    keywords = ['patch']
    message_count = 3.0
    messages = ['381542', '381549', '381610']
    nosy_count = 3.0
    nosy_names = ['christian.heimes', 'petr.viktorin', 'serhiy.storchaka']
    pr_nums = ['23441']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue42423'
    versions = ['Python 3.10']

    @serhiy-storchaka
    Copy link
    Member Author

    @serhiy-storchaka serhiy-storchaka commented Nov 21, 2020

    It is common that class have a single base class. PyType_FromModuleAndSpec() is only called with NULL as bases (that means inheriting object) in the stdlib, and PyType_FromSpecWithBases() is called with a 1-tuple as bases all three times (not counting tests).

    Since it is a common case, PyErr_NewException() accept both a tuple and a single class as the base argument. I propose to accept a single class also in PyType_FromSpecWithBases() and PyType_FromModuleAndSpec().

    @serhiy-storchaka serhiy-storchaka added 3.10 expert-C-API type-feature labels Nov 21, 2020
    @tiran
    Copy link
    Member

    @tiran tiran commented Nov 21, 2020

    Excellent idea

    @serhiy-storchaka
    Copy link
    Member Author

    @serhiy-storchaka serhiy-storchaka commented Nov 22, 2020

    New changeset 686c203 by Serhiy Storchaka in branch 'master':
    bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441)
    686c203

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 expert-C-API type-feature
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants