[New-bugs-announce] [issue45464] TypeError when inheriting from both OSError and AttributeError

Marek Marczykowski-Górecki report at bugs.python.org
Wed Oct 13 16:05:16 EDT 2021


New submission from Marek Marczykowski-Górecki <marmarek at mimuw.edu.pl>:

In Python 3.10 it is no longer possible to create an exception type that inherits from both OSError and AttributeError. This has worked in Python 3.9.
I don't see anything in changelog/release notes that would suggest it being intentional.

Behavior in Python 3.9:

Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(OSError, AttributeError): pass
... 
>>> C
<class '__main__.C'>


Behavior in Python 3.10:

Python 3.10.0 (default, Oct  4 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(OSError, AttributeError): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict


My (very) wild guess is this being related to https://bugs.python.org/issue38530

----------
components: Interpreter Core
messages: 403870
nosy: marmarek
priority: normal
severity: normal
status: open
title: TypeError when inheriting from both OSError and AttributeError
type: behavior
versions: Python 3.10

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


More information about the New-bugs-announce mailing list