mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
GH-89519: Deprecate classmethod descriptor chaining (#92379)
This commit is contained in:
parent
bebb944de5
commit
ebaf0945f9
4 changed files with 20 additions and 1 deletions
|
@ -1349,6 +1349,8 @@ Using the non-data descriptor protocol, a pure Python version of
|
|||
if cls is None:
|
||||
cls = type(obj)
|
||||
if hasattr(type(self.f), '__get__'):
|
||||
# This code path was added in Python 3.9
|
||||
# and was deprecated in Python 3.11.
|
||||
return self.f.__get__(cls, cls)
|
||||
return MethodType(self.f, cls)
|
||||
|
||||
|
@ -1386,7 +1388,7 @@ Using the non-data descriptor protocol, a pure Python version of
|
|||
The code path for ``hasattr(type(self.f), '__get__')`` was added in
|
||||
Python 3.9 and makes it possible for :func:`classmethod` to support
|
||||
chained decorators. For example, a classmethod and property could be
|
||||
chained together:
|
||||
chained together. In Python 3.11, this functionality was deprecated.
|
||||
|
||||
.. testcode::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue