recreate_cm() also emits DeprecatingWarning

This commit is contained in:
Nick Coghlan 2024-05-23 17:05:27 +10:00
parent c223508344
commit 3c49b081bc

View file

@ -114,6 +114,7 @@ class ContextDecorator(object):
DEPRECATED: refresh_cm was never added to the standard library's
ContextDecorator API
"""
import warnings # Only import if needed for the deprecation warning
warnings.warn("refresh_cm was never added to the standard library",
DeprecationWarning)
return self._recreate_cm()
@ -857,7 +858,7 @@ class chdir(AbstractContextManager):
# Preserve backwards compatibility
class ContextStack(ExitStack):
"""Backwards compatibility alias for ExitStack"""
"""(DEPRECATED) Backwards compatibility alias for ExitStack"""
def __init__(self):
import warnings # Only import if needed for the deprecation warning