[Python-checkins] Clarify the order of a stacked `abstractmethod` (GH-26892)

miss-islington webhook-mailer at python.org
Sun Jun 27 14:51:09 EDT 2021


https://github.com/python/cpython/commit/c95cdf2dae185b1241c0b1e07635dc632267e37e
commit: c95cdf2dae185b1241c0b1e07635dc632267e37e
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-06-27T11:50:38-07:00
summary:

Clarify the order of a stacked `abstractmethod` (GH-26892)


Co-authored-by: Tal Einat <532281+taleinat at users.noreply.github.com>
(cherry picked from commit 74d60eab558bffdf5ca8ea2f5305e19b36bdb9a8)

Co-authored-by: Ram Rachum <ram at rachum.com>

files:
M Lib/abc.py

diff --git a/Lib/abc.py b/Lib/abc.py
index 276ef9a2cd485..3c552cebb4226 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -28,7 +28,14 @@ def my_abstract_method(self, ...):
 class abstractclassmethod(classmethod):
     """A decorator indicating abstract classmethods.
 
-    Deprecated, use 'classmethod' with 'abstractmethod' instead.
+    Deprecated, use 'classmethod' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @classmethod
+            @abstractmethod
+            def my_abstract_classmethod(cls, ...):
+                ...
+
     """
 
     __isabstractmethod__ = True
@@ -41,7 +48,14 @@ def __init__(self, callable):
 class abstractstaticmethod(staticmethod):
     """A decorator indicating abstract staticmethods.
 
-    Deprecated, use 'staticmethod' with 'abstractmethod' instead.
+    Deprecated, use 'staticmethod' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @staticmethod
+            @abstractmethod
+            def my_abstract_staticmethod(...):
+                ...
+
     """
 
     __isabstractmethod__ = True
@@ -54,7 +68,14 @@ def __init__(self, callable):
 class abstractproperty(property):
     """A decorator indicating abstract properties.
 
-    Deprecated, use 'property' with 'abstractmethod' instead.
+    Deprecated, use 'property' with 'abstractmethod' instead:
+
+        class C(ABC):
+            @property
+            @abstractmethod
+            def my_abstract_property(self):
+                ...
+
     """
 
     __isabstractmethod__ = True



More information about the Python-checkins mailing list