forked from orbit-oss/flask
deprecate locked_cached_property
This commit is contained in:
parent
c690f529f2
commit
4256fc6304
4 changed files with 22 additions and 6 deletions
|
|
@ -613,6 +613,10 @@ class locked_cached_property(werkzeug.utils.cached_property):
|
|||
:class:`werkzeug.utils.cached_property` except access uses a lock
|
||||
for thread safety.
|
||||
|
||||
.. deprecated:: 2.3
|
||||
Will be removed in Flask 2.4. Use a lock inside the decorated function if
|
||||
locking is needed.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
Inherits from Werkzeug's ``cached_property`` (and ``property``).
|
||||
"""
|
||||
|
|
@ -623,6 +627,14 @@ class locked_cached_property(werkzeug.utils.cached_property):
|
|||
name: t.Optional[str] = None,
|
||||
doc: t.Optional[str] = None,
|
||||
) -> None:
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"'locked_cached_property' is deprecated and will be removed in Flask 2.4."
|
||||
" Use a lock inside the decorated function if locking is needed.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super().__init__(fget, name=name, doc=doc)
|
||||
self.lock = RLock()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue