This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Support passing single class to PyType_FromSpecWithBases and PyType_FromModuleAndSpec
Type: enhancement Stage: resolved
Components: C API Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, petr.viktorin, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-11-21 10:19 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23441 merged serhiy.storchaka, 2020-11-21 10:34
Messages (3)
msg381542 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-11-21 10:19
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().
msg381549 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-21 11:30
Excellent idea
msg381610 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-11-22 11:25
New changeset 686c203cd4355be5b7809a9d24b4aa3566d9371f by Serhiy Storchaka in branch 'master':
bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441)
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86589
2020-11-22 11:53:56serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-22 11:25:10serhiy.storchakasetmessages: + msg381610
2020-11-21 11:30:13christian.heimessetmessages: + msg381549
2020-11-21 10:34:04serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request22333
2020-11-21 10:24:04serhiy.storchakasetnosy: + petr.viktorin
2020-11-21 10:19:14serhiy.storchakacreate