File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1329,7 +1329,7 @@ Using the non-data descriptor protocol, a pure Python version of
13291329 def __get__(self, obj, cls=None):
13301330 if cls is None:
13311331 cls = type(obj)
1332- if hasattr(obj , '__get__'):
1332+ if hasattr(type(self.f) , '__get__'):
13331333 return self.f.__get__(cls)
13341334 return MethodType(self.f, cls)
13351335
@@ -1342,6 +1342,12 @@ Using the non-data descriptor protocol, a pure Python version of
13421342 def cm(cls, x, y):
13431343 return (cls, x, y)
13441344
1345+ @ClassMethod
1346+ @property
1347+ def __doc__(cls):
1348+ return f'A doc for {cls.__name__!r}'
1349+
1350+
13451351.. doctest ::
13461352 :hide:
13471353
@@ -1353,6 +1359,11 @@ Using the non-data descriptor protocol, a pure Python version of
13531359 >>> t.cm(11 , 22 )
13541360 (<class 'T'>, 11, 22)
13551361
1362+ # Check the alternate path for chained descriptors
1363+ >>> T.__doc__
1364+ "A doc for 'T'"
1365+
1366+
13561367The code path for ``hasattr(obj, '__get__') `` was added in Python 3.9 and
13571368makes it possible for :func: `classmethod ` to support chained decorators.
13581369For example, a classmethod and property could be chained together:
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ Brian Curtin
388388Jason Curtis
389389Hakan Celik
390390Paul Dagnelie
391- Florian Dahlitz
391+ Florian Dahlitz
392392Lisandro Dalcin
393393Darren Dale
394394Andrew Dalke
@@ -694,6 +694,7 @@ Michael Haubenwallner
694694Janko Hauser
695695Flavian Hautbois
696696Rycharde Hawkes
697+ Yahor Harunovich
697698Ben Hayden
698699Jochen Hayek
699700Tim Heaney
You can’t perform that action at this time.
0 commit comments