Skip to content

rest_framework.permissions.BasePermission causes a Metaclass conflict error #282

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

Closed
mattwwarren opened this issue Nov 10, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@mattwwarren
Copy link
Contributor

Bug report

What's wrong

After upgrading to mypy 0.990 (from 0.982), the following code example causes a Metaclass conflict

from rest_framework.permissions import BasePermission

class OrgPermissions(BasePermission):
    ...

How it should be

Running mypy on the above class should not cause

error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]

I'm also willing to accept this is an improper use of Metaclasses by drf directly but I've never seen this error in running code so I figured I would start with a bug here.

System information

  • OS: Linux
  • python version: 3.9.x
  • django version: 4.0.x
  • mypy version: 0.990
  • django-stubs version: 1.12.x
@mattwwarren mattwwarren added the bug Something isn't working label Nov 10, 2022
@mattwwarren mattwwarren changed the title rest_framework.permissions.BasePermission rest_framework.permissions.BasePermission causes a Metaclass conflict error Nov 10, 2022
@jwhitlock
Copy link

Also seen in PR #280, signature of BasePermission changed. Updating to djangorestframework-stubs 1.8.0, which includes that change, fixed it for me.

@dmartin
Copy link

dmartin commented Nov 22, 2022

Upgrading to 1.8.0 resolved this error for me as well.

@mattwwarren
Copy link
Contributor Author

Can confirm upgrading to 1.8.0 fixed the original issue. Thank you!

@mattwwarren mattwwarren closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2022
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

3 participants