bpo-41905: Add abc.update_abstractmethods() (GH-22485)

This function recomputes `cls.__abstractmethods__`.
Also update `@dataclass` to use it.
This commit is contained in:
Ben Avrahami 2020-10-06 20:40:50 +03:00 committed by GitHub
parent a8bf44d049
commit bef7d299eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 256 additions and 5 deletions

View file

@ -6,6 +6,7 @@ import inspect
import keyword
import builtins
import functools
import abc
import _thread
from types import GenericAlias
@ -992,6 +993,8 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen):
cls.__doc__ = (cls.__name__ +
str(inspect.signature(cls)).replace(' -> None', ''))
abc.update_abstractmethods(cls)
return cls