This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Subclass of both `ABC` and `ABCMeta` breaks on `__subclasscheck__`
Type: Stage:
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: erezinman, gvanrossum, kamilturek, terry.reedy
Priority: normal Keywords:

Created on 2021-03-22 13:42 by erezinman, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg389314 - (view) Author: Erez Zinman (erezinman) Date: 2021-03-22 13:42
Consider the following example:

```
from abc import ABCMeta, ABC

class MetaclassMixin(ABC):
    pass 

class Meta(MetaclassMixin, ABCMeta):
    pass

class A(metaclass=Meta):
    pass

```

Then the call `isinstance(A, Meta)` returns `True` but `isinstance(1, Meta)` raises 

 >>> TypeError: __subclasscheck__() missing 1 required positional argument: 'subclass'

Checked on 3.6.9, 3.8.0 & 3.8.8
msg389562 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-03-26 19:25
Verified on Win10 for 3.8-3.10.  3.6 only gets security fixes.

Guido, is the above a bug?  (There is no listed abc or 'metaclass' expert and I don't know.)
msg389573 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-03-26 23:17
I think it's strange code -- the mixin wants to be a metaclass but also an ABC (which is not a meta class). Unless there's a serious use case I'm inclinded to reply "don't care".
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87760
2021-03-26 23:17:05gvanrossumsetmessages: + msg389573
2021-03-26 19:25:36terry.reedysetnosy: + gvanrossum, terry.reedy
title: A metaclass that inherits both `ABC` and `ABCMeta` breaks on `__subclasscheck__` -> Subclass of both `ABC` and `ABCMeta` breaks on `__subclasscheck__`
messages: + msg389562

versions: + Python 3.9, Python 3.10, - Python 3.6
2021-03-22 21:58:23kamiltureksetnosy: + kamilturek
2021-03-22 13:42:00erezinmancreate