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

False positive "metaclass conflict" error with GenericViewSet #692

Open
realsuayip opened this issue Nov 6, 2024 · 0 comments
Open

False positive "metaclass conflict" error with GenericViewSet #692

realsuayip opened this issue Nov 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@realsuayip
Copy link
Contributor

When using a custom metaclass with GenericViewSet will create "metaclass conflict" error. This seems to be due to some issue in mypy:

python/mypy#15040

GenericViewSet uses UsesQuerySet which is a Protocol, whose metaclass is ABCMeta, but during runtime type(GenericViewSet) is actually type

Using ABCMeta as base in custom metaclass fixes the issue, which is mostly fine although not entirely "correct".

I guess using protocols is more helpful than just satisfying an edge metaclass case. There seems to be some work in progress in mypy that might fix this issue, in the meantime, I wanted to open this issue here so that other people could see the cause & possible fix.

@realsuayip realsuayip added the bug Something isn't working label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant