classification
Title: Create companion methods of "PyType_FromSpec*" to allow setting metaclass.
Type: enhancement Stage: patch review
Components: C API Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: WildCard65
Priority: normal Keywords: patch

Created on 2020-06-30 15:34 by WildCard65, last changed 2020-06-30 16:29 by WildCard65.

Pull Requests
URL Status Linked Edit
PR 21238 open WildCard65, 2020-06-30 16:29
Messages (2)
msg372696 - (view) Author: William Pickard (WildCard65) * Date: 2020-06-30 15:34
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)
msg372697 - (view) Author: William Pickard (WildCard65) * Date: 2020-06-30 15:35
Another thing I thought of, if this is accepted, we can turn the "PyType" methods into header static inline methods.
History
Date User Action Args
2020-06-30 16:29:58WildCard65setkeywords: + patch
stage: patch review
pull_requests: + pull_request20390
2020-06-30 15:35:26WildCard65setmessages: + msg372697
2020-06-30 15:34:35WildCard65create