Skip to content

Commit 5fdcbbd

Browse files
committed
-
1 parent b5f4f66 commit 5fdcbbd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source_py3/python_toolbox/context_management/functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ def _wrap_context_manager_or_class(cls, thing):
160160
thing.__name__,
161161
''.join(random.choice(string.ascii_letters) for _ in range(30))
162162
)
163+
# We're exposing the wrapped context manager under two names,
164+
# `__wrapped__` and a randomly created one. The first one is used
165+
# for convenience but we still define the second one to ensure our
166+
# mechanism can rely on it even when the `__wrapped__` attribute is
167+
# being overridden.
163168
return type(
164169
thing.__name__,
165170
(thing,),

0 commit comments

Comments
 (0)