Ethan Furman <et...@stoneleaf.us> added the comment:
I tried update `abc.py` with the same dance I have to use with `Enum`: def __new__(mcls, name, bases, namespace, **kwargs): # remove current __init_subclass__ so previous one can be found with getattr try: new_init_subclass = namespace.get('__init_subclass__') del namespace['__init_subclass__'] except KeyError: pass # create our new ABC type if bases: bases = (_NoInitSubclass, ) + bases abc_cls = super().__new__(mcls, name, bases, namespace, **kwargs) abc_cls.__bases__ = abc_cls.__bases__[1:] else: abc_cls = super().__new__(mcls, name, bases, namespace, **kwargs) old_init_subclass = getattr(abc_cls, '__init_subclass__', None) # restore new __init_subclass__ (if there was one) if new_init_subclass is not None: abc_cls.__init_subclass__ = classmethod(new_init_subclass) _abc_init(abc_cls) # call parents' __init_subclass__ if old_init_subclass is not None: old_init_subclass(**kwargs) return abc_cls But I get this error: Fatal Python error: init_import_site: Failed to import the site module Python runtime state: initialized Traceback (most recent call last): File "/home/ethan/source/python/cpython/Lib/site.py", line 73, in <module> import os File "/home/ethan/source/python/cpython/Lib/os.py", line 29, in <module> from _collections_abc import _check_methods File "/home/ethan/source/python/cpython/Lib/_collections_abc.py", line 122, in <module> class Coroutine(Awaitable): File "/home/ethan/source/python/cpython/Lib/abc.py", line 103, in __new__ abc_cls.__bases__ = abc_cls.__bases__[1:] TypeError: __bases__ assignment: 'Awaitable' object layout differs from '_NoInitSubclass' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35815> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com