[New-bugs-announce] [issue15870] PyType_FromSpec should take metaclass as an argument
Alexander Belopolsky
report at bugs.python.org
Thu Sep 6 17:49:26 CEST 2012
New submission from Alexander Belopolsky:
PyType_FromSpec() is a convenient function to create types dynamically in C extension modules, but its usefulness is limited by the fact that it creates new types using the default metaclass.
I suggest adding a new C API function
PyObject *PyType_FromSpecEx(PyObject *meta, PyType_Spec *spec)
and redefine PyType_FromSpec() as
PyType_FromSpecEx((PyObject *)&PyType_Type, spec)
This functionality cannot be implemented by user because PyType_FromSpec requires access to private slotoffsets table.
A (trivial) patch attached.
----------
assignee: belopolsky
components: Interpreter Core
files: typeobject.diff
keywords: needs review, patch
messages: 169925
nosy: belopolsky, loewis
priority: normal
severity: normal
stage: test needed
status: open
title: PyType_FromSpec should take metaclass as an argument
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file27137/typeobject.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15870>
_______________________________________
More information about the New-bugs-announce
mailing list