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

CIMultiDict can not be subclassed #416

Closed
qwesda opened this issue Dec 11, 2019 · 0 comments · Fixed by #417
Closed

CIMultiDict can not be subclassed #416

qwesda opened this issue Dec 11, 2019 · 0 comments · Fixed by #417

Comments

@qwesda
Copy link
Contributor

qwesda commented Dec 11, 2019

Describe the bug
CIMultiDict can not be subclassed because the type definition does not have the Py_TPFLAGS_BASETYPE flag set.

static PyTypeObject cimultidict_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"multidict._multidict.CIMultiDict", /* tp_name */
sizeof(MultiDictObject), /* tp_basicsize */
.tp_dealloc = (destructor)multidict_tp_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,

static PyTypeObject cimultidict_proxy_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"multidict._multidict.CIMultiDictProxy", /* tp_name */
sizeof(MultiDictProxyObject), /* tp_basicsize */
.tp_dealloc = (destructor)multidict_proxy_tp_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,

To Reproduce
The following code fails with TypeError: type 'multidict._multidict.CIMultiDict' is not an acceptable base type

from multidict import CIMultiDict

class Header(CIMultiDict):
    pass

Expected behavior
CIMultiDict should be subclassable like MultiDict

Your version of the Python
3.6 and 3.7

Your version of the multidict distribution
4.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant