summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorBen Avrahami <avrahami.ben@gmail.com>2020-10-06 17:40:50 (GMT)
committerGitHub <noreply@github.com>2020-10-06 17:40:50 (GMT)
commitbef7d299eb911086ea5a7ccf7a9da337e38a8491 (patch)
tree25508f320dada76441df02c0ce5b756608524b39 /Lib/dataclasses.py
parenta8bf44d04915f7366d9f8dfbf84822ac37a4bab3 (diff)
downloadcpython-bef7d299eb911086ea5a7ccf7a9da337e38a8491.zip
cpython-bef7d299eb911086ea5a7ccf7a9da337e38a8491.tar.gz
cpython-bef7d299eb911086ea5a7ccf7a9da337e38a8491.tar.bz2
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.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 530d3e9..6509102 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