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
1329
1329
def __get__(self, obj, cls=None):
1330
1330
if cls is None:
1331
1331
cls = type(obj)
1332
- if hasattr(obj , '__get__'):
1332
+ if hasattr(type(self.f) , '__get__'):
1333
1333
return self.f.__get__(cls)
1334
1334
return MethodType(self.f, cls)
1335
1335
@@ -1342,6 +1342,12 @@ Using the non-data descriptor protocol, a pure Python version of
1342
1342
def cm(cls, x, y):
1343
1343
return (cls, x, y)
1344
1344
1345
+ @ClassMethod
1346
+ @property
1347
+ def __doc__(cls):
1348
+ return f'A doc for {cls.__name__!r}'
1349
+
1350
+
1345
1351
.. doctest ::
1346
1352
:hide:
1347
1353
@@ -1353,6 +1359,11 @@ Using the non-data descriptor protocol, a pure Python version of
1353
1359
>>> t.cm(11 , 22 )
1354
1360
(<class 'T'>, 11, 22)
1355
1361
1362
+ # Check the alternate path for chained descriptors
1363
+ >>> T.__doc__
1364
+ "A doc for 'T'"
1365
+
1366
+
1356
1367
The code path for ``hasattr(obj, '__get__') `` was added in Python 3.9 and
1357
1368
makes it possible for :func: `classmethod ` to support chained decorators.
1358
1369
For 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
388
388
Jason Curtis
389
389
Hakan Celik
390
390
Paul Dagnelie
391
- Florian Dahlitz
391
+ Florian Dahlitz
392
392
Lisandro Dalcin
393
393
Darren Dale
394
394
Andrew Dalke
@@ -694,6 +694,7 @@ Michael Haubenwallner
694
694
Janko Hauser
695
695
Flavian Hautbois
696
696
Rycharde Hawkes
697
+ Yahor Harunovich
697
698
Ben Hayden
698
699
Jochen Hayek
699
700
Tim Heaney
You can’t perform that action at this time.
0 commit comments