diff options
author | Ben Avrahami <avrahami.ben@gmail.com> | 2020-10-06 20:40:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-06 10:40:50 -0700 |
commit | bef7d299eb911086ea5a7ccf7a9da337e38a8491 (patch) | |
tree | 25508f320dada76441df02c0ce5b756608524b39 /Lib/dataclasses.py | |
parent | a8bf44d04915f7366d9f8dfbf84822ac37a4bab3 (diff) | |
download | cpython-bef7d299eb911086ea5a7ccf7a9da337e38a8491.tar.gz cpython-bef7d299eb911086ea5a7ccf7a9da337e38a8491.zip |
bpo-41905: Add abc.update_abstractmethods() (GH-22485)
This function recomputes `cls.__abstractmethods__`.
Also update `@dataclass` to use it.
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r-- | Lib/dataclasses.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 530d3e99574..65091021f37 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -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 |