From 3c49b081bce20be77ec0b37aa7ce6d6de7d60cf7 Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Thu, 23 May 2024 17:05:27 +1000 Subject: [PATCH] recreate_cm() also emits DeprecatingWarning --- contextlib2/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contextlib2/__init__.py b/contextlib2/__init__.py index 514f3df..8278201 100644 --- a/contextlib2/__init__.py +++ b/contextlib2/__init__.py @@ -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