mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-39481: Make functools.cached_property, partial, partialmethod generic (#19427)
This commit is contained in:
parent
584a3cfda4
commit
cecf049673
3 changed files with 10 additions and 0 deletions
|
@ -20,6 +20,7 @@ from collections import namedtuple
|
|||
# import types, weakref # Deferred to single_dispatch()
|
||||
from reprlib import recursive_repr
|
||||
from _thread import RLock
|
||||
from types import GenericAlias
|
||||
|
||||
|
||||
################################################################################
|
||||
|
@ -656,6 +657,9 @@ class partialmethod(object):
|
|||
def __isabstractmethod__(self):
|
||||
return getattr(self.func, "__isabstractmethod__", False)
|
||||
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
||||
|
||||
# Helper functions
|
||||
|
||||
def _unwrap_partial(func):
|
||||
|
@ -1208,3 +1212,5 @@ class cached_property:
|
|||
)
|
||||
raise TypeError(msg) from None
|
||||
return val
|
||||
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue