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.

Author felixxm
Recipients barry, eli.bendersky, ethan.furman, felixxm
Date 2021-01-07.06:39:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
We noticed a behavior change in Python3.10.0a4 (it works properly in Python3.10.0a3) when running Django's test suite[1]. Subclassing `enum.Enum` with `ipaddress.IPv4Network/IPv6Network` raises `TypeError`, e.g.

>>> import enum
>>> import ipaddress
>>> class NewEnum(ipaddress.IPv4Address, enum.Enum):
...     pass
>>> class NewEnum(ipaddress.IPv4Network, enum.Enum):
...     pass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/", line 239, in __new__
    enum_class.__bases__ = enum_class.__bases__[1:] #or (object, )
  File "/usr/local/lib/python3.10/", line 483, in __setattr__
    super().__setattr__(name, value)
TypeError: __bases__ assignment: 'IPv4Network' object layout differs from '_NoInitSubclass'

It still works for `ipaddress.IPv4Address/IPv6Address`.

Date User Action Args
2021-01-07 06:39:43felixxmsetrecipients: + felixxm, barry, eli.bendersky, ethan.furman
2021-01-07 06:39:43felixxmsetmessageid: <>
2021-01-07 06:39:43felixxmlinkissue42851 messages
2021-01-07 06:39:43felixxmcreate