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 @@ -1319,7 +1319,7 @@ Using the non-data descriptor protocol, a pure Python version of
1319
1319
def __get__(self, obj, cls=None):
1320
1320
if cls is None:
1321
1321
cls = type(obj)
1322
- if hasattr(obj , '__get__'):
1322
+ if hasattr(type(self.f) , '__get__'):
1323
1323
return self.f.__get__(cls)
1324
1324
return MethodType(self.f, cls)
1325
1325
@@ -1332,6 +1332,12 @@ Using the non-data descriptor protocol, a pure Python version of
1332
1332
def cm(cls, x, y):
1333
1333
return (cls, x, y)
1334
1334
1335
+ @ClassMethod
1336
+ @property
1337
+ def __doc__(cls):
1338
+ return f'A doc for {cls.__name__!r}'
1339
+
1340
+
1335
1341
.. doctest ::
1336
1342
:hide:
1337
1343
@@ -1343,6 +1349,11 @@ Using the non-data descriptor protocol, a pure Python version of
1343
1349
>>> t.cm(11 , 22 )
1344
1350
(<class 'T'>, 11, 22)
1345
1351
1352
+ # Check the alternate path for chained descriptors
1353
+ >>> T.__doc__
1354
+ "A doc for 'T'"
1355
+
1356
+
1346
1357
The code path for ``hasattr(obj, '__get__') `` was added in Python 3.9 and
1347
1358
makes it possible for :func: `classmethod ` to support chained decorators.
1348
1359
For example, a classmethod and property could be chained together:
Original file line number Diff line number Diff line change @@ -380,7 +380,7 @@ Brian Curtin
380
380
Jason Curtis
381
381
Hakan Celik
382
382
Paul Dagnelie
383
- Florian Dahlitz
383
+ Florian Dahlitz
384
384
Lisandro Dalcin
385
385
Darren Dale
386
386
Andrew Dalke
@@ -684,6 +684,7 @@ Michael Haubenwallner
684
684
Janko Hauser
685
685
Flavian Hautbois
686
686
Rycharde Hawkes
687
+ Yahor Harunovich
687
688
Ben Hayden
688
689
Jochen Hayek
689
690
Tim Heaney
You can’t perform that action at this time.
0 commit comments