[issue45464] TypeError when inheriting from both OSError and AttributeError

Pablo Galindo Salgado report at bugs.python.org
Thu Oct 14 12:52:58 EDT 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

Also, just to clarify something: there is no guarantee that multiple build-in, unrelated exceptions can be inherited and this is not supported. And this is not unique to this case. For example:

>>> class A(StopIteration, OSError):
...    ...
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict

>>> class A(SyntaxError, OSError):
...    pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict
>>> class A(ModuleNotFoundError, OSError):
...    ...
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45464>
_______________________________________


More information about the Python-bugs-list mailing list